/**
 *
 */
import Util;
import OpenApi;
import OpenApiUtil;
import EndpointUtil;

extends OpenApi;


init(config: OpenApi.Config){
  super(config);
  @endpointRule = '';
  
  checkConfig(config);
  @endpoint = getEndpoint('xixikf', @regionId, @endpointRule, @network, @suffix, @endpointMap, @endpoint);
}

function getEndpoint(productId: string, regionId: string, endpointRule: string, network: string, suffix: string, endpointMap: map[string]string, endpoint: string) throws: string{
  if (!Util.empty(endpoint)) {
    return endpoint;
  }
  
  if (!Util.isUnset(endpointMap) && !Util.empty(endpointMap[regionId])) {
    return endpointMap[regionId];
  }
  return EndpointUtil.getEndpointRules(productId, regionId, endpointRule, network, suffix);
}

model AnswerCallRequest {
  accountName?: string(name='AccountName'),
  callId?: string(name='CallId'),
  clientToken?: string(name='ClientToken'),
  connectionId?: string(name='ConnectionId'),
  instanceId?: string(name='InstanceId'),
  jobId?: string(name='JobId'),
}

model AnswerCallResponseBody = {
  code?: string(name='Code'),
  message?: string(name='Message'),
  requestId?: string(name='RequestId'),
  success?: boolean(name='Success'),
}

model AnswerCallResponse = {
  headers: map[string]string(name='headers'),
  statusCode: int32(name='statusCode'),
  body: AnswerCallResponseBody(name='body'),
}

async function answerCallWithOptions(request: AnswerCallRequest, runtime: Util.RuntimeOptions): AnswerCallResponse {
  Util.validateModel(request);
  var body : map[string]any = {};
  if (!Util.isUnset(request.accountName)) {
    body['AccountName'] = request.accountName;
  }
  if (!Util.isUnset(request.callId)) {
    body['CallId'] = request.callId;
  }
  if (!Util.isUnset(request.clientToken)) {
    body['ClientToken'] = request.clientToken;
  }
  if (!Util.isUnset(request.connectionId)) {
    body['ConnectionId'] = request.connectionId;
  }
  if (!Util.isUnset(request.instanceId)) {
    body['InstanceId'] = request.instanceId;
  }
  if (!Util.isUnset(request.jobId)) {
    body['JobId'] = request.jobId;
  }
  var req = new OpenApi.OpenApiRequest{ 
    body = OpenApiUtil.parseToMap(body),
  };
  var params = new OpenApi.Params{
    action = 'AnswerCall',
    version = '2020-07-30',
    protocol = 'HTTPS',
    pathname = '/',
    method = 'POST',
    authType = 'AK',
    style = 'RPC',
    reqBodyType = 'formData',
    bodyType = 'json',
  };
  return callApi(params, req, runtime);
}

async function answerCall(request: AnswerCallRequest): AnswerCallResponse {
  var runtime = new Util.RuntimeOptions{};
  return answerCallWithOptions(request, runtime);
}

model AppMessagePushRequest {
  expirationTime?: long(name='ExpirationTime'),
  instanceId?: string(name='InstanceId'),
  status?: int32(name='Status'),
  userId?: string(name='UserId'),
}

model AppMessagePushResponseBody = {
  code?: string(name='Code'),
  data?: string(name='Data'),
  message?: string(name='Message'),
  requestId?: string(name='RequestId'),
  success?: boolean(name='Success'),
}

model AppMessagePushResponse = {
  headers: map[string]string(name='headers'),
  statusCode: int32(name='statusCode'),
  body: AppMessagePushResponseBody(name='body'),
}

async function appMessagePushWithOptions(request: AppMessagePushRequest, runtime: Util.RuntimeOptions): AppMessagePushResponse {
  Util.validateModel(request);
  var query = {};
  if (!Util.isUnset(request.expirationTime)) {
    query['ExpirationTime'] = request.expirationTime;
  }
  if (!Util.isUnset(request.instanceId)) {
    query['InstanceId'] = request.instanceId;
  }
  if (!Util.isUnset(request.status)) {
    query['Status'] = request.status;
  }
  if (!Util.isUnset(request.userId)) {
    query['UserId'] = request.userId;
  }
  var req = new OpenApi.OpenApiRequest{ 
    query = OpenApiUtil.query(query),
  };
  var params = new OpenApi.Params{
    action = 'AppMessagePush',
    version = '2020-07-30',
    protocol = 'HTTPS',
    pathname = '/',
    method = 'POST',
    authType = 'AK',
    style = 'RPC',
    reqBodyType = 'formData',
    bodyType = 'json',
  };
  return callApi(params, req, runtime);
}

async function appMessagePush(request: AppMessagePushRequest): AppMessagePushResponse {
  var runtime = new Util.RuntimeOptions{};
  return appMessagePushWithOptions(request, runtime);
}

model AssignTicketRequest {
  acceptorId?: long(name='AcceptorId'),
  clientToken?: string(name='ClientToken'),
  instanceId?: string(name='InstanceId'),
  operatorId?: long(name='OperatorId'),
  ticketId?: long(name='TicketId'),
}

model AssignTicketResponseBody = {
  code?: string(name='Code'),
  message?: string(name='Message'),
  requestId?: string(name='RequestId'),
  success?: boolean(name='Success'),
}

model AssignTicketResponse = {
  headers: map[string]string(name='headers'),
  statusCode: int32(name='statusCode'),
  body: AssignTicketResponseBody(name='body'),
}

async function assignTicketWithOptions(request: AssignTicketRequest, runtime: Util.RuntimeOptions): AssignTicketResponse {
  Util.validateModel(request);
  var body : map[string]any = {};
  if (!Util.isUnset(request.acceptorId)) {
    body['AcceptorId'] = request.acceptorId;
  }
  if (!Util.isUnset(request.clientToken)) {
    body['ClientToken'] = request.clientToken;
  }
  if (!Util.isUnset(request.instanceId)) {
    body['InstanceId'] = request.instanceId;
  }
  if (!Util.isUnset(request.operatorId)) {
    body['OperatorId'] = request.operatorId;
  }
  if (!Util.isUnset(request.ticketId)) {
    body['TicketId'] = request.ticketId;
  }
  var req = new OpenApi.OpenApiRequest{ 
    body = OpenApiUtil.parseToMap(body),
  };
  var params = new OpenApi.Params{
    action = 'AssignTicket',
    version = '2020-07-30',
    protocol = 'HTTPS',
    pathname = '/',
    method = 'POST',
    authType = 'AK',
    style = 'RPC',
    reqBodyType = 'formData',
    bodyType = 'json',
  };
  return callApi(params, req, runtime);
}

async function assignTicket(request: AssignTicketRequest): AssignTicketResponse {
  var runtime = new Util.RuntimeOptions{};
  return assignTicketWithOptions(request, runtime);
}

model ChangeChatAgentStatusRequest {
  accountName?: string(name='AccountName'),
  clientToken?: string(name='ClientToken'),
  instanceId?: string(name='InstanceId'),
  method?: string(name='Method'),
}

model ChangeChatAgentStatusResponseBody = {
  code?: string(name='Code'),
  data?: string(name='Data'),
  httpStatusCode?: int32(name='HttpStatusCode'),
  message?: string(name='Message'),
  requestId?: string(name='RequestId'),
  success?: boolean(name='Success'),
}

model ChangeChatAgentStatusResponse = {
  headers: map[string]string(name='headers'),
  statusCode: int32(name='statusCode'),
  body: ChangeChatAgentStatusResponseBody(name='body'),
}

async function changeChatAgentStatusWithOptions(request: ChangeChatAgentStatusRequest, runtime: Util.RuntimeOptions): ChangeChatAgentStatusResponse {
  Util.validateModel(request);
  var body : map[string]any = {};
  if (!Util.isUnset(request.accountName)) {
    body['AccountName'] = request.accountName;
  }
  if (!Util.isUnset(request.clientToken)) {
    body['ClientToken'] = request.clientToken;
  }
  if (!Util.isUnset(request.instanceId)) {
    body['InstanceId'] = request.instanceId;
  }
  if (!Util.isUnset(request.method)) {
    body['Method'] = request.method;
  }
  var req = new OpenApi.OpenApiRequest{ 
    body = OpenApiUtil.parseToMap(body),
  };
  var params = new OpenApi.Params{
    action = 'ChangeChatAgentStatus',
    version = '2020-07-30',
    protocol = 'HTTPS',
    pathname = '/',
    method = 'POST',
    authType = 'AK',
    style = 'RPC',
    reqBodyType = 'formData',
    bodyType = 'json',
  };
  return callApi(params, req, runtime);
}

async function changeChatAgentStatus(request: ChangeChatAgentStatusRequest): ChangeChatAgentStatusResponse {
  var runtime = new Util.RuntimeOptions{};
  return changeChatAgentStatusWithOptions(request, runtime);
}

model CloseTicketRequest {
  actionItems?: string(name='ActionItems'),
  clientToken?: string(name='ClientToken'),
  instanceId?: string(name='InstanceId'),
  operatorId?: long(name='OperatorId'),
  ticketId?: long(name='TicketId'),
}

model CloseTicketResponseBody = {
  code?: string(name='Code'),
  httpStatusCode?: long(name='HttpStatusCode'),
  message?: string(name='Message'),
  requestId?: string(name='RequestId'),
  success?: boolean(name='Success'),
}

model CloseTicketResponse = {
  headers: map[string]string(name='headers'),
  statusCode: int32(name='statusCode'),
  body: CloseTicketResponseBody(name='body'),
}

async function closeTicketWithOptions(request: CloseTicketRequest, runtime: Util.RuntimeOptions): CloseTicketResponse {
  Util.validateModel(request);
  var body : map[string]any = {};
  if (!Util.isUnset(request.actionItems)) {
    body['ActionItems'] = request.actionItems;
  }
  if (!Util.isUnset(request.clientToken)) {
    body['ClientToken'] = request.clientToken;
  }
  if (!Util.isUnset(request.instanceId)) {
    body['InstanceId'] = request.instanceId;
  }
  if (!Util.isUnset(request.operatorId)) {
    body['OperatorId'] = request.operatorId;
  }
  if (!Util.isUnset(request.ticketId)) {
    body['TicketId'] = request.ticketId;
  }
  var req = new OpenApi.OpenApiRequest{ 
    body = OpenApiUtil.parseToMap(body),
  };
  var params = new OpenApi.Params{
    action = 'CloseTicket',
    version = '2020-07-30',
    protocol = 'HTTPS',
    pathname = '/',
    method = 'POST',
    authType = 'AK',
    style = 'RPC',
    reqBodyType = 'formData',
    bodyType = 'json',
  };
  return callApi(params, req, runtime);
}

async function closeTicket(request: CloseTicketRequest): CloseTicketResponse {
  var runtime = new Util.RuntimeOptions{};
  return closeTicketWithOptions(request, runtime);
}

model CreateAgentRequest {
  accountName?: string(name='AccountName'),
  clientToken?: string(name='ClientToken'),
  displayName?: string(name='DisplayName'),
  instanceId?: string(name='InstanceId'),
  skillGroupId?: [ long ](name='SkillGroupId'),
  skillGroupIdList?: [ long ](name='SkillGroupIdList'),
}

model CreateAgentResponseBody = {
  code?: string(name='Code'),
  data?: long(name='Data'),
  httpStatusCode?: long(name='HttpStatusCode'),
  message?: string(name='Message'),
  requestId?: string(name='RequestId'),
  success?: boolean(name='Success'),
}

model CreateAgentResponse = {
  headers: map[string]string(name='headers'),
  statusCode: int32(name='statusCode'),
  body: CreateAgentResponseBody(name='body'),
}

async function createAgentWithOptions(request: CreateAgentRequest, runtime: Util.RuntimeOptions): CreateAgentResponse {
  Util.validateModel(request);
  var body : map[string]any = {};
  if (!Util.isUnset(request.accountName)) {
    body['AccountName'] = request.accountName;
  }
  if (!Util.isUnset(request.clientToken)) {
    body['ClientToken'] = request.clientToken;
  }
  if (!Util.isUnset(request.displayName)) {
    body['DisplayName'] = request.displayName;
  }
  if (!Util.isUnset(request.instanceId)) {
    body['InstanceId'] = request.instanceId;
  }
  var bodyFlat : map[string]any = {};
  if (!Util.isUnset(request.skillGroupId)) {
    bodyFlat['SkillGroupId'] = request.skillGroupId;
  }
  if (!Util.isUnset(request.skillGroupIdList)) {
    bodyFlat['SkillGroupIdList'] = request.skillGroupIdList;
  }
  body = {
    ...body,
    ...OpenApiUtil.query(bodyFlat),
  };

  var req = new OpenApi.OpenApiRequest{ 
    body = OpenApiUtil.parseToMap(body),
  };
  var params = new OpenApi.Params{
    action = 'CreateAgent',
    version = '2020-07-30',
    protocol = 'HTTPS',
    pathname = '/',
    method = 'POST',
    authType = 'AK',
    style = 'RPC',
    reqBodyType = 'formData',
    bodyType = 'json',
  };
  return callApi(params, req, runtime);
}

async function createAgent(request: CreateAgentRequest): CreateAgentResponse {
  var runtime = new Util.RuntimeOptions{};
  return createAgentWithOptions(request, runtime);
}

model CreateCustomerRequest {
  bizType?: string(name='BizType'),
  contacter?: string(name='Contacter'),
  dingding?: string(name='Dingding'),
  email?: string(name='Email'),
  industry?: string(name='Industry'),
  instanceId?: string(name='InstanceId'),
  managerName?: string(name='ManagerName'),
  name?: string(name='Name'),
  outerId?: string(name='OuterId'),
  outerIdType?: int32(name='OuterIdType'),
  phone?: string(name='Phone'),
  position?: string(name='Position'),
  prodLineId?: long(name='ProdLineId'),
  typeCode?: string(name='TypeCode'),
}

model CreateCustomerResponseBody = {
  code?: string(name='Code'),
  data?: long(name='Data'),
  message?: string(name='Message'),
  requestId?: string(name='RequestId'),
  success?: boolean(name='Success'),
}

model CreateCustomerResponse = {
  headers: map[string]string(name='headers'),
  statusCode: int32(name='statusCode'),
  body: CreateCustomerResponseBody(name='body'),
}

async function createCustomerWithOptions(request: CreateCustomerRequest, runtime: Util.RuntimeOptions): CreateCustomerResponse {
  Util.validateModel(request);
  var query = {};
  if (!Util.isUnset(request.bizType)) {
    query['BizType'] = request.bizType;
  }
  if (!Util.isUnset(request.contacter)) {
    query['Contacter'] = request.contacter;
  }
  if (!Util.isUnset(request.dingding)) {
    query['Dingding'] = request.dingding;
  }
  if (!Util.isUnset(request.email)) {
    query['Email'] = request.email;
  }
  if (!Util.isUnset(request.industry)) {
    query['Industry'] = request.industry;
  }
  if (!Util.isUnset(request.instanceId)) {
    query['InstanceId'] = request.instanceId;
  }
  if (!Util.isUnset(request.managerName)) {
    query['ManagerName'] = request.managerName;
  }
  if (!Util.isUnset(request.name)) {
    query['Name'] = request.name;
  }
  if (!Util.isUnset(request.outerId)) {
    query['OuterId'] = request.outerId;
  }
  if (!Util.isUnset(request.outerIdType)) {
    query['OuterIdType'] = request.outerIdType;
  }
  if (!Util.isUnset(request.phone)) {
    query['Phone'] = request.phone;
  }
  if (!Util.isUnset(request.position)) {
    query['Position'] = request.position;
  }
  if (!Util.isUnset(request.prodLineId)) {
    query['ProdLineId'] = request.prodLineId;
  }
  if (!Util.isUnset(request.typeCode)) {
    query['TypeCode'] = request.typeCode;
  }
  var req = new OpenApi.OpenApiRequest{ 
    query = OpenApiUtil.query(query),
  };
  var params = new OpenApi.Params{
    action = 'CreateCustomer',
    version = '2020-07-30',
    protocol = 'HTTPS',
    pathname = '/',
    method = 'POST',
    authType = 'AK',
    style = 'RPC',
    reqBodyType = 'formData',
    bodyType = 'json',
  };
  return callApi(params, req, runtime);
}

async function createCustomer(request: CreateCustomerRequest): CreateCustomerResponse {
  var runtime = new Util.RuntimeOptions{};
  return createCustomerWithOptions(request, runtime);
}

model CreateEntityIvrRouteRequest {
  departmentId?: string(name='DepartmentId'),
  entityBizCode?: string(name='EntityBizCode'),
  entityBizCodeType?: string(name='EntityBizCodeType'),
  entityId?: string(name='EntityId'),
  entityName?: string(name='EntityName'),
  entityRelationNumber?: string(name='EntityRelationNumber'),
  extInfo?: string(name='ExtInfo'),
  groupId?: long(name='GroupId'),
  instanceId?: string(name='InstanceId'),
  serviceId?: long(name='ServiceId'),
}

model CreateEntityIvrRouteResponseBody = {
  code?: string(name='Code'),
  message?: string(name='Message'),
  requestId?: string(name='RequestId'),
  success?: boolean(name='Success'),
}

model CreateEntityIvrRouteResponse = {
  headers: map[string]string(name='headers'),
  statusCode: int32(name='statusCode'),
  body: CreateEntityIvrRouteResponseBody(name='body'),
}

async function createEntityIvrRouteWithOptions(request: CreateEntityIvrRouteRequest, runtime: Util.RuntimeOptions): CreateEntityIvrRouteResponse {
  Util.validateModel(request);
  var body : map[string]any = {};
  if (!Util.isUnset(request.departmentId)) {
    body['DepartmentId'] = request.departmentId;
  }
  if (!Util.isUnset(request.entityBizCode)) {
    body['EntityBizCode'] = request.entityBizCode;
  }
  if (!Util.isUnset(request.entityBizCodeType)) {
    body['EntityBizCodeType'] = request.entityBizCodeType;
  }
  if (!Util.isUnset(request.entityId)) {
    body['EntityId'] = request.entityId;
  }
  if (!Util.isUnset(request.entityName)) {
    body['EntityName'] = request.entityName;
  }
  if (!Util.isUnset(request.entityRelationNumber)) {
    body['EntityRelationNumber'] = request.entityRelationNumber;
  }
  if (!Util.isUnset(request.extInfo)) {
    body['ExtInfo'] = request.extInfo;
  }
  if (!Util.isUnset(request.groupId)) {
    body['GroupId'] = request.groupId;
  }
  if (!Util.isUnset(request.instanceId)) {
    body['InstanceId'] = request.instanceId;
  }
  if (!Util.isUnset(request.serviceId)) {
    body['ServiceId'] = request.serviceId;
  }
  var req = new OpenApi.OpenApiRequest{ 
    body = OpenApiUtil.parseToMap(body),
  };
  var params = new OpenApi.Params{
    action = 'CreateEntityIvrRoute',
    version = '2020-07-30',
    protocol = 'HTTPS',
    pathname = '/',
    method = 'POST',
    authType = 'AK',
    style = 'RPC',
    reqBodyType = 'formData',
    bodyType = 'json',
  };
  return callApi(params, req, runtime);
}

async function createEntityIvrRoute(request: CreateEntityIvrRouteRequest): CreateEntityIvrRouteResponse {
  var runtime = new Util.RuntimeOptions{};
  return createEntityIvrRouteWithOptions(request, runtime);
}

model CreateOuterCallCenterDataRequest {
  bizId?: string(name='BizId'),
  bizType?: string(name='BizType'),
  callType?: string(name='CallType'),
  endReason?: string(name='EndReason'),
  extInfo?: string(name='ExtInfo'),
  fromPhoneNum?: string(name='FromPhoneNum'),
  instanceId?: string(name='InstanceId'),
  interveneTime?: string(name='InterveneTime'),
  recordUrl?: string(name='RecordUrl'),
  sessionId?: string(name='SessionId'),
  tenantId?: string(name='TenantId'),
  toPhoneNum?: string(name='ToPhoneNum'),
  userInfo?: string(name='UserInfo'),
}

model CreateOuterCallCenterDataResponseBody = {
  code?: string(name='Code'),
  httpStatusCode?: long(name='HttpStatusCode'),
  message?: string(name='Message'),
  requestId?: string(name='RequestId'),
  success?: boolean(name='Success'),
}

model CreateOuterCallCenterDataResponse = {
  headers: map[string]string(name='headers'),
  statusCode: int32(name='statusCode'),
  body: CreateOuterCallCenterDataResponseBody(name='body'),
}

async function createOuterCallCenterDataWithOptions(request: CreateOuterCallCenterDataRequest, runtime: Util.RuntimeOptions): CreateOuterCallCenterDataResponse {
  Util.validateModel(request);
  var body : map[string]any = {};
  if (!Util.isUnset(request.bizId)) {
    body['BizId'] = request.bizId;
  }
  if (!Util.isUnset(request.bizType)) {
    body['BizType'] = request.bizType;
  }
  if (!Util.isUnset(request.callType)) {
    body['CallType'] = request.callType;
  }
  if (!Util.isUnset(request.endReason)) {
    body['EndReason'] = request.endReason;
  }
  if (!Util.isUnset(request.extInfo)) {
    body['ExtInfo'] = request.extInfo;
  }
  if (!Util.isUnset(request.fromPhoneNum)) {
    body['FromPhoneNum'] = request.fromPhoneNum;
  }
  if (!Util.isUnset(request.instanceId)) {
    body['InstanceId'] = request.instanceId;
  }
  if (!Util.isUnset(request.interveneTime)) {
    body['InterveneTime'] = request.interveneTime;
  }
  if (!Util.isUnset(request.recordUrl)) {
    body['RecordUrl'] = request.recordUrl;
  }
  if (!Util.isUnset(request.sessionId)) {
    body['SessionId'] = request.sessionId;
  }
  if (!Util.isUnset(request.tenantId)) {
    body['TenantId'] = request.tenantId;
  }
  if (!Util.isUnset(request.toPhoneNum)) {
    body['ToPhoneNum'] = request.toPhoneNum;
  }
  if (!Util.isUnset(request.userInfo)) {
    body['UserInfo'] = request.userInfo;
  }
  var req = new OpenApi.OpenApiRequest{ 
    body = OpenApiUtil.parseToMap(body),
  };
  var params = new OpenApi.Params{
    action = 'CreateOuterCallCenterData',
    version = '2020-07-30',
    protocol = 'HTTPS',
    pathname = '/',
    method = 'POST',
    authType = 'AK',
    style = 'RPC',
    reqBodyType = 'formData',
    bodyType = 'json',
  };
  return callApi(params, req, runtime);
}

async function createOuterCallCenterData(request: CreateOuterCallCenterDataRequest): CreateOuterCallCenterDataResponse {
  var runtime = new Util.RuntimeOptions{};
  return createOuterCallCenterDataWithOptions(request, runtime);
}

model CreateRoleRequest {
  clientToken?: string(name='ClientToken'),
  instanceId?: string(name='InstanceId'),
  operator?: string(name='Operator'),
  permissionId?: [ long ](name='PermissionId'),
  roleName?: string(name='RoleName'),
}

model CreateRoleResponseBody = {
  code?: string(name='Code'),
  data?: long(name='Data'),
  httpStatusCode?: long(name='HttpStatusCode'),
  message?: string(name='Message'),
  requestId?: string(name='RequestId'),
  success?: boolean(name='Success'),
}

model CreateRoleResponse = {
  headers: map[string]string(name='headers'),
  statusCode: int32(name='statusCode'),
  body: CreateRoleResponseBody(name='body'),
}

async function createRoleWithOptions(request: CreateRoleRequest, runtime: Util.RuntimeOptions): CreateRoleResponse {
  Util.validateModel(request);
  var body : map[string]any = {};
  if (!Util.isUnset(request.clientToken)) {
    body['ClientToken'] = request.clientToken;
  }
  if (!Util.isUnset(request.instanceId)) {
    body['InstanceId'] = request.instanceId;
  }
  if (!Util.isUnset(request.operator)) {
    body['Operator'] = request.operator;
  }
  if (!Util.isUnset(request.permissionId)) {
    body['PermissionId'] = request.permissionId;
  }
  if (!Util.isUnset(request.roleName)) {
    body['RoleName'] = request.roleName;
  }
  var req = new OpenApi.OpenApiRequest{ 
    body = OpenApiUtil.parseToMap(body),
  };
  var params = new OpenApi.Params{
    action = 'CreateRole',
    version = '2020-07-30',
    protocol = 'HTTPS',
    pathname = '/',
    method = 'POST',
    authType = 'AK',
    style = 'RPC',
    reqBodyType = 'formData',
    bodyType = 'json',
  };
  return callApi(params, req, runtime);
}

async function createRole(request: CreateRoleRequest): CreateRoleResponse {
  var runtime = new Util.RuntimeOptions{};
  return createRoleWithOptions(request, runtime);
}

model CreateSkillGroupRequest {
  channelType?: int32(name='ChannelType'),
  clientToken?: string(name='ClientToken'),
  description?: string(name='Description'),
  displayName?: string(name='DisplayName'),
  instanceId?: string(name='InstanceId'),
  skillGroupName?: string(name='SkillGroupName'),
}

model CreateSkillGroupResponseBody = {
  code?: string(name='Code'),
  data?: long(name='Data'),
  message?: string(name='Message'),
  requestId?: string(name='RequestId'),
  success?: boolean(name='Success'),
}

model CreateSkillGroupResponse = {
  headers: map[string]string(name='headers'),
  statusCode: int32(name='statusCode'),
  body: CreateSkillGroupResponseBody(name='body'),
}

async function createSkillGroupWithOptions(request: CreateSkillGroupRequest, runtime: Util.RuntimeOptions): CreateSkillGroupResponse {
  Util.validateModel(request);
  var body : map[string]any = {};
  if (!Util.isUnset(request.channelType)) {
    body['ChannelType'] = request.channelType;
  }
  if (!Util.isUnset(request.clientToken)) {
    body['ClientToken'] = request.clientToken;
  }
  if (!Util.isUnset(request.description)) {
    body['Description'] = request.description;
  }
  if (!Util.isUnset(request.displayName)) {
    body['DisplayName'] = request.displayName;
  }
  if (!Util.isUnset(request.instanceId)) {
    body['InstanceId'] = request.instanceId;
  }
  if (!Util.isUnset(request.skillGroupName)) {
    body['SkillGroupName'] = request.skillGroupName;
  }
  var req = new OpenApi.OpenApiRequest{ 
    body = OpenApiUtil.parseToMap(body),
  };
  var params = new OpenApi.Params{
    action = 'CreateSkillGroup',
    version = '2020-07-30',
    protocol = 'HTTPS',
    pathname = '/',
    method = 'POST',
    authType = 'AK',
    style = 'RPC',
    reqBodyType = 'formData',
    bodyType = 'json',
  };
  return callApi(params, req, runtime);
}

async function createSkillGroup(request: CreateSkillGroupRequest): CreateSkillGroupResponse {
  var runtime = new Util.RuntimeOptions{};
  return createSkillGroupWithOptions(request, runtime);
}

model CreateThirdSsoAgentRequest {
  accountId?: string(name='AccountId'),
  accountName?: string(name='AccountName'),
  clientId?: string(name='ClientId'),
  clientToken?: string(name='ClientToken'),
  displayName?: string(name='DisplayName'),
  instanceId?: string(name='InstanceId'),
  roleIds?: [ long ](name='RoleIds'),
  skillGroupIds?: [ long ](name='SkillGroupIds'),
}

model CreateThirdSsoAgentResponseBody = {
  code?: string(name='Code'),
  data?: long(name='Data'),
  httpStatusCode?: long(name='HttpStatusCode'),
  message?: string(name='Message'),
  requestId?: string(name='RequestId'),
  success?: boolean(name='Success'),
}

model CreateThirdSsoAgentResponse = {
  headers: map[string]string(name='headers'),
  statusCode: int32(name='statusCode'),
  body: CreateThirdSsoAgentResponseBody(name='body'),
}

async function createThirdSsoAgentWithOptions(request: CreateThirdSsoAgentRequest, runtime: Util.RuntimeOptions): CreateThirdSsoAgentResponse {
  Util.validateModel(request);
  var body : map[string]any = {};
  if (!Util.isUnset(request.accountId)) {
    body['AccountId'] = request.accountId;
  }
  if (!Util.isUnset(request.accountName)) {
    body['AccountName'] = request.accountName;
  }
  if (!Util.isUnset(request.clientId)) {
    body['ClientId'] = request.clientId;
  }
  if (!Util.isUnset(request.clientToken)) {
    body['ClientToken'] = request.clientToken;
  }
  if (!Util.isUnset(request.displayName)) {
    body['DisplayName'] = request.displayName;
  }
  if (!Util.isUnset(request.instanceId)) {
    body['InstanceId'] = request.instanceId;
  }
  var bodyFlat : map[string]any = {};
  if (!Util.isUnset(request.roleIds)) {
    bodyFlat['RoleIds'] = request.roleIds;
  }
  if (!Util.isUnset(request.skillGroupIds)) {
    bodyFlat['SkillGroupIds'] = request.skillGroupIds;
  }
  body = {
    ...body,
    ...OpenApiUtil.query(bodyFlat),
  };

  var req = new OpenApi.OpenApiRequest{ 
    body = OpenApiUtil.parseToMap(body),
  };
  var params = new OpenApi.Params{
    action = 'CreateThirdSsoAgent',
    version = '2020-07-30',
    protocol = 'HTTPS',
    pathname = '/',
    method = 'POST',
    authType = 'AK',
    style = 'RPC',
    reqBodyType = 'formData',
    bodyType = 'json',
  };
  return callApi(params, req, runtime);
}

async function createThirdSsoAgent(request: CreateThirdSsoAgentRequest): CreateThirdSsoAgentResponse {
  var runtime = new Util.RuntimeOptions{};
  return createThirdSsoAgentWithOptions(request, runtime);
}

model CreateTicketRequest {
  carbonCopy?: string(name='CarbonCopy'),
  categoryId?: long(name='CategoryId'),
  clientToken?: string(name='ClientToken'),
  creatorId?: long(name='CreatorId'),
  creatorName?: string(name='CreatorName'),
  creatorType?: int32(name='CreatorType'),
  formData?: string(name='FormData'),
  fromInfo?: string(name='FromInfo'),
  instanceId?: string(name='InstanceId'),
  memberId?: long(name='MemberId'),
  memberName?: string(name='MemberName'),
  priority?: int32(name='Priority'),
  templateId?: long(name='TemplateId'),
}

model CreateTicketResponseBody = {
  code?: string(name='Code'),
  data?: long(name='Data'),
  message?: string(name='Message'),
  requestId?: string(name='RequestId'),
  success?: boolean(name='Success'),
}

model CreateTicketResponse = {
  headers: map[string]string(name='headers'),
  statusCode: int32(name='statusCode'),
  body: CreateTicketResponseBody(name='body'),
}

async function createTicketWithOptions(request: CreateTicketRequest, runtime: Util.RuntimeOptions): CreateTicketResponse {
  Util.validateModel(request);
  var body : map[string]any = {};
  if (!Util.isUnset(request.carbonCopy)) {
    body['CarbonCopy'] = request.carbonCopy;
  }
  if (!Util.isUnset(request.categoryId)) {
    body['CategoryId'] = request.categoryId;
  }
  if (!Util.isUnset(request.clientToken)) {
    body['ClientToken'] = request.clientToken;
  }
  if (!Util.isUnset(request.creatorId)) {
    body['CreatorId'] = request.creatorId;
  }
  if (!Util.isUnset(request.creatorName)) {
    body['CreatorName'] = request.creatorName;
  }
  if (!Util.isUnset(request.creatorType)) {
    body['CreatorType'] = request.creatorType;
  }
  if (!Util.isUnset(request.formData)) {
    body['FormData'] = request.formData;
  }
  if (!Util.isUnset(request.fromInfo)) {
    body['FromInfo'] = request.fromInfo;
  }
  if (!Util.isUnset(request.instanceId)) {
    body['InstanceId'] = request.instanceId;
  }
  if (!Util.isUnset(request.memberId)) {
    body['MemberId'] = request.memberId;
  }
  if (!Util.isUnset(request.memberName)) {
    body['MemberName'] = request.memberName;
  }
  if (!Util.isUnset(request.priority)) {
    body['Priority'] = request.priority;
  }
  if (!Util.isUnset(request.templateId)) {
    body['TemplateId'] = request.templateId;
  }
  var req = new OpenApi.OpenApiRequest{ 
    body = OpenApiUtil.parseToMap(body),
  };
  var params = new OpenApi.Params{
    action = 'CreateTicket',
    version = '2020-07-30',
    protocol = 'HTTPS',
    pathname = '/',
    method = 'POST',
    authType = 'AK',
    style = 'RPC',
    reqBodyType = 'formData',
    bodyType = 'json',
  };
  return callApi(params, req, runtime);
}

async function createTicket(request: CreateTicketRequest): CreateTicketResponse {
  var runtime = new Util.RuntimeOptions{};
  return createTicketWithOptions(request, runtime);
}

model CreateTicketWithDataRequest {
  agentId?: long(name='AgentId'),
  bizData?: string(name='BizData'),
  buId?: long(name='BuId'),
  caseType?: int32(name='CaseType'),
  categoryId?: long(name='CategoryId'),
  cc?: string(name='Cc'),
  channelId?: string(name='ChannelId'),
  channelType?: int32(name='ChannelType'),
  clientToken?: string(name='ClientToken'),
  createdTime?: string(name='CreatedTime'),
  creatorId?: long(name='CreatorId'),
  creatorName?: string(name='CreatorName'),
  creatorType?: int32(name='CreatorType'),
  departmentId?: long(name='DepartmentId'),
  endTime?: string(name='EndTime'),
  extAttr?: string(name='ExtAttr'),
  feedback?: string(name='Feedback'),
  formData?: string(name='FormData'),
  fromInfo?: string(name='FromInfo'),
  instanceId?: string(name='InstanceId'),
  memberId?: long(name='MemberId'),
  memberName?: string(name='MemberName'),
  memberType?: int32(name='MemberType'),
  modifiedTime?: string(name='ModifiedTime'),
  parentCaseId?: long(name='ParentCaseId'),
  planEndTime?: string(name='PlanEndTime'),
  priority?: int32(name='Priority'),
  queueId?: long(name='QueueId'),
  refCaseId?: long(name='RefCaseId'),
  status?: int32(name='Status'),
  tag?: string(name='Tag'),
  templateId?: long(name='TemplateId'),
  touchId?: long(name='TouchId'),
}

model CreateTicketWithDataResponseBody = {
  code?: string(name='Code'),
  data?: long(name='Data'),
  httpStatusCode?: int32(name='HttpStatusCode'),
  message?: string(name='Message'),
  requestId?: string(name='RequestId'),
  success?: boolean(name='Success'),
}

model CreateTicketWithDataResponse = {
  headers: map[string]string(name='headers'),
  statusCode: int32(name='statusCode'),
  body: CreateTicketWithDataResponseBody(name='body'),
}

async function createTicketWithDataWithOptions(request: CreateTicketWithDataRequest, runtime: Util.RuntimeOptions): CreateTicketWithDataResponse {
  Util.validateModel(request);
  var body : map[string]any = {};
  if (!Util.isUnset(request.agentId)) {
    body['AgentId'] = request.agentId;
  }
  if (!Util.isUnset(request.bizData)) {
    body['BizData'] = request.bizData;
  }
  if (!Util.isUnset(request.buId)) {
    body['BuId'] = request.buId;
  }
  if (!Util.isUnset(request.caseType)) {
    body['CaseType'] = request.caseType;
  }
  if (!Util.isUnset(request.categoryId)) {
    body['CategoryId'] = request.categoryId;
  }
  if (!Util.isUnset(request.cc)) {
    body['Cc'] = request.cc;
  }
  if (!Util.isUnset(request.channelId)) {
    body['ChannelId'] = request.channelId;
  }
  if (!Util.isUnset(request.channelType)) {
    body['ChannelType'] = request.channelType;
  }
  if (!Util.isUnset(request.clientToken)) {
    body['ClientToken'] = request.clientToken;
  }
  if (!Util.isUnset(request.createdTime)) {
    body['CreatedTime'] = request.createdTime;
  }
  if (!Util.isUnset(request.creatorId)) {
    body['CreatorId'] = request.creatorId;
  }
  if (!Util.isUnset(request.creatorName)) {
    body['CreatorName'] = request.creatorName;
  }
  if (!Util.isUnset(request.creatorType)) {
    body['CreatorType'] = request.creatorType;
  }
  if (!Util.isUnset(request.departmentId)) {
    body['DepartmentId'] = request.departmentId;
  }
  if (!Util.isUnset(request.endTime)) {
    body['EndTime'] = request.endTime;
  }
  if (!Util.isUnset(request.extAttr)) {
    body['ExtAttr'] = request.extAttr;
  }
  if (!Util.isUnset(request.feedback)) {
    body['Feedback'] = request.feedback;
  }
  if (!Util.isUnset(request.formData)) {
    body['FormData'] = request.formData;
  }
  if (!Util.isUnset(request.fromInfo)) {
    body['FromInfo'] = request.fromInfo;
  }
  if (!Util.isUnset(request.instanceId)) {
    body['InstanceId'] = request.instanceId;
  }
  if (!Util.isUnset(request.memberId)) {
    body['MemberId'] = request.memberId;
  }
  if (!Util.isUnset(request.memberName)) {
    body['MemberName'] = request.memberName;
  }
  if (!Util.isUnset(request.memberType)) {
    body['MemberType'] = request.memberType;
  }
  if (!Util.isUnset(request.modifiedTime)) {
    body['ModifiedTime'] = request.modifiedTime;
  }
  if (!Util.isUnset(request.parentCaseId)) {
    body['ParentCaseId'] = request.parentCaseId;
  }
  if (!Util.isUnset(request.planEndTime)) {
    body['PlanEndTime'] = request.planEndTime;
  }
  if (!Util.isUnset(request.priority)) {
    body['Priority'] = request.priority;
  }
  if (!Util.isUnset(request.queueId)) {
    body['QueueId'] = request.queueId;
  }
  if (!Util.isUnset(request.refCaseId)) {
    body['RefCaseId'] = request.refCaseId;
  }
  if (!Util.isUnset(request.status)) {
    body['Status'] = request.status;
  }
  if (!Util.isUnset(request.tag)) {
    body['Tag'] = request.tag;
  }
  if (!Util.isUnset(request.templateId)) {
    body['TemplateId'] = request.templateId;
  }
  if (!Util.isUnset(request.touchId)) {
    body['TouchId'] = request.touchId;
  }
  var req = new OpenApi.OpenApiRequest{ 
    body = OpenApiUtil.parseToMap(body),
  };
  var params = new OpenApi.Params{
    action = 'CreateTicketWithData',
    version = '2020-07-30',
    protocol = 'HTTPS',
    pathname = '/',
    method = 'POST',
    authType = 'AK',
    style = 'RPC',
    reqBodyType = 'formData',
    bodyType = 'json',
  };
  return callApi(params, req, runtime);
}

async function createTicketWithData(request: CreateTicketWithDataRequest): CreateTicketWithDataResponse {
  var runtime = new Util.RuntimeOptions{};
  return createTicketWithDataWithOptions(request, runtime);
}

model CreateTicketWithStatusRequest {
  carbonCopy?: string(name='CarbonCopy'),
  categoryId?: long(name='CategoryId'),
  channelId?: string(name='ChannelId'),
  channelType?: string(name='ChannelType'),
  clientToken?: string(name='ClientToken'),
  creatorId?: long(name='CreatorId'),
  creatorName?: string(name='CreatorName'),
  creatorType?: int32(name='CreatorType'),
  formData?: string(name='FormData'),
  fromInfo?: string(name='FromInfo'),
  instanceId?: string(name='InstanceId'),
  memberId?: long(name='MemberId'),
  memberName?: string(name='MemberName'),
  priority?: int32(name='Priority'),
  templateId?: long(name='TemplateId'),
  touchId?: string(name='TouchId'),
  status?: int32(name='status'),
}

model CreateTicketWithStatusResponseBody = {
  code?: string(name='Code'),
  data?: long(name='Data'),
  message?: string(name='Message'),
  requestId?: string(name='RequestId'),
  success?: boolean(name='Success'),
}

model CreateTicketWithStatusResponse = {
  headers: map[string]string(name='headers'),
  statusCode: int32(name='statusCode'),
  body: CreateTicketWithStatusResponseBody(name='body'),
}

async function createTicketWithStatusWithOptions(request: CreateTicketWithStatusRequest, runtime: Util.RuntimeOptions): CreateTicketWithStatusResponse {
  Util.validateModel(request);
  var body : map[string]any = {};
  if (!Util.isUnset(request.carbonCopy)) {
    body['CarbonCopy'] = request.carbonCopy;
  }
  if (!Util.isUnset(request.categoryId)) {
    body['CategoryId'] = request.categoryId;
  }
  if (!Util.isUnset(request.channelId)) {
    body['ChannelId'] = request.channelId;
  }
  if (!Util.isUnset(request.channelType)) {
    body['ChannelType'] = request.channelType;
  }
  if (!Util.isUnset(request.clientToken)) {
    body['ClientToken'] = request.clientToken;
  }
  if (!Util.isUnset(request.creatorId)) {
    body['CreatorId'] = request.creatorId;
  }
  if (!Util.isUnset(request.creatorName)) {
    body['CreatorName'] = request.creatorName;
  }
  if (!Util.isUnset(request.creatorType)) {
    body['CreatorType'] = request.creatorType;
  }
  if (!Util.isUnset(request.formData)) {
    body['FormData'] = request.formData;
  }
  if (!Util.isUnset(request.fromInfo)) {
    body['FromInfo'] = request.fromInfo;
  }
  if (!Util.isUnset(request.instanceId)) {
    body['InstanceId'] = request.instanceId;
  }
  if (!Util.isUnset(request.memberId)) {
    body['MemberId'] = request.memberId;
  }
  if (!Util.isUnset(request.memberName)) {
    body['MemberName'] = request.memberName;
  }
  if (!Util.isUnset(request.priority)) {
    body['Priority'] = request.priority;
  }
  if (!Util.isUnset(request.templateId)) {
    body['TemplateId'] = request.templateId;
  }
  if (!Util.isUnset(request.touchId)) {
    body['TouchId'] = request.touchId;
  }
  if (!Util.isUnset(request.status)) {
    body['status'] = request.status;
  }
  var req = new OpenApi.OpenApiRequest{ 
    body = OpenApiUtil.parseToMap(body),
  };
  var params = new OpenApi.Params{
    action = 'CreateTicketWithStatus',
    version = '2020-07-30',
    protocol = 'HTTPS',
    pathname = '/',
    method = 'POST',
    authType = 'AK',
    style = 'RPC',
    reqBodyType = 'formData',
    bodyType = 'json',
  };
  return callApi(params, req, runtime);
}

async function createTicketWithStatus(request: CreateTicketWithStatusRequest): CreateTicketWithStatusResponse {
  var runtime = new Util.RuntimeOptions{};
  return createTicketWithStatusWithOptions(request, runtime);
}

model DeleteAgentRequest {
  accountName?: string(name='AccountName'),
  clientToken?: string(name='ClientToken'),
  instanceId?: string(name='InstanceId'),
}

model DeleteAgentResponseBody = {
  code?: string(name='Code'),
  httpStatusCode?: long(name='HttpStatusCode'),
  message?: string(name='Message'),
  requestId?: string(name='RequestId'),
  success?: boolean(name='Success'),
}

model DeleteAgentResponse = {
  headers: map[string]string(name='headers'),
  statusCode: int32(name='statusCode'),
  body: DeleteAgentResponseBody(name='body'),
}

async function deleteAgentWithOptions(request: DeleteAgentRequest, runtime: Util.RuntimeOptions): DeleteAgentResponse {
  Util.validateModel(request);
  var query = {};
  if (!Util.isUnset(request.accountName)) {
    query['AccountName'] = request.accountName;
  }
  if (!Util.isUnset(request.clientToken)) {
    query['ClientToken'] = request.clientToken;
  }
  if (!Util.isUnset(request.instanceId)) {
    query['InstanceId'] = request.instanceId;
  }
  var req = new OpenApi.OpenApiRequest{ 
    query = OpenApiUtil.query(query),
  };
  var params = new OpenApi.Params{
    action = 'DeleteAgent',
    version = '2020-07-30',
    protocol = 'HTTPS',
    pathname = '/',
    method = 'DELETE',
    authType = 'AK',
    style = 'RPC',
    reqBodyType = 'formData',
    bodyType = 'json',
  };
  return callApi(params, req, runtime);
}

async function deleteAgent(request: DeleteAgentRequest): DeleteAgentResponse {
  var runtime = new Util.RuntimeOptions{};
  return deleteAgentWithOptions(request, runtime);
}

model DeleteEntityRouteRequest {
  instanceId?: string(name='InstanceId'),
  uniqueId?: long(name='UniqueId'),
}

model DeleteEntityRouteResponseBody = {
  code?: string(name='Code'),
  message?: string(name='Message'),
  requestId?: string(name='RequestId'),
  success?: boolean(name='Success'),
}

model DeleteEntityRouteResponse = {
  headers: map[string]string(name='headers'),
  statusCode: int32(name='statusCode'),
  body: DeleteEntityRouteResponseBody(name='body'),
}

async function deleteEntityRouteWithOptions(request: DeleteEntityRouteRequest, runtime: Util.RuntimeOptions): DeleteEntityRouteResponse {
  Util.validateModel(request);
  var body : map[string]any = {};
  if (!Util.isUnset(request.instanceId)) {
    body['InstanceId'] = request.instanceId;
  }
  if (!Util.isUnset(request.uniqueId)) {
    body['UniqueId'] = request.uniqueId;
  }
  var req = new OpenApi.OpenApiRequest{ 
    body = OpenApiUtil.parseToMap(body),
  };
  var params = new OpenApi.Params{
    action = 'DeleteEntityRoute',
    version = '2020-07-30',
    protocol = 'HTTPS',
    pathname = '/',
    method = 'POST',
    authType = 'AK',
    style = 'RPC',
    reqBodyType = 'formData',
    bodyType = 'json',
  };
  return callApi(params, req, runtime);
}

async function deleteEntityRoute(request: DeleteEntityRouteRequest): DeleteEntityRouteResponse {
  var runtime = new Util.RuntimeOptions{};
  return deleteEntityRouteWithOptions(request, runtime);
}

model DisableRoleRequest {
  clientToken?: string(name='ClientToken'),
  instanceId?: string(name='InstanceId'),
  roleId?: long(name='RoleId'),
}

model DisableRoleResponseBody = {
  code?: string(name='Code'),
  message?: string(name='Message'),
  requestId?: string(name='RequestId'),
  success?: boolean(name='Success'),
}

model DisableRoleResponse = {
  headers: map[string]string(name='headers'),
  statusCode: int32(name='statusCode'),
  body: DisableRoleResponseBody(name='body'),
}

async function disableRoleWithOptions(request: DisableRoleRequest, runtime: Util.RuntimeOptions): DisableRoleResponse {
  Util.validateModel(request);
  var body : map[string]any = {};
  if (!Util.isUnset(request.clientToken)) {
    body['ClientToken'] = request.clientToken;
  }
  if (!Util.isUnset(request.instanceId)) {
    body['InstanceId'] = request.instanceId;
  }
  if (!Util.isUnset(request.roleId)) {
    body['RoleId'] = request.roleId;
  }
  var req = new OpenApi.OpenApiRequest{ 
    body = OpenApiUtil.parseToMap(body),
  };
  var params = new OpenApi.Params{
    action = 'DisableRole',
    version = '2020-07-30',
    protocol = 'HTTPS',
    pathname = '/',
    method = 'POST',
    authType = 'AK',
    style = 'RPC',
    reqBodyType = 'formData',
    bodyType = 'json',
  };
  return callApi(params, req, runtime);
}

async function disableRole(request: DisableRoleRequest): DisableRoleResponse {
  var runtime = new Util.RuntimeOptions{};
  return disableRoleWithOptions(request, runtime);
}

model EditEntityRouteRequest {
  departmentId?: string(name='DepartmentId'),
  entityBizCode?: string(name='EntityBizCode'),
  entityBizCodeType?: string(name='EntityBizCodeType'),
  entityId?: string(name='EntityId'),
  entityName?: string(name='EntityName'),
  entityRelationNumber?: string(name='EntityRelationNumber'),
  extInfo?: string(name='ExtInfo'),
  groupId?: long(name='GroupId'),
  instanceId?: string(name='InstanceId'),
  serviceId?: long(name='ServiceId'),
  uniqueId?: long(name='UniqueId'),
}

model EditEntityRouteResponseBody = {
  code?: string(name='Code'),
  message?: string(name='Message'),
  requestId?: string(name='RequestId'),
  success?: boolean(name='Success'),
}

model EditEntityRouteResponse = {
  headers: map[string]string(name='headers'),
  statusCode: int32(name='statusCode'),
  body: EditEntityRouteResponseBody(name='body'),
}

async function editEntityRouteWithOptions(request: EditEntityRouteRequest, runtime: Util.RuntimeOptions): EditEntityRouteResponse {
  Util.validateModel(request);
  var body : map[string]any = {};
  if (!Util.isUnset(request.departmentId)) {
    body['DepartmentId'] = request.departmentId;
  }
  if (!Util.isUnset(request.entityBizCode)) {
    body['EntityBizCode'] = request.entityBizCode;
  }
  if (!Util.isUnset(request.entityBizCodeType)) {
    body['EntityBizCodeType'] = request.entityBizCodeType;
  }
  if (!Util.isUnset(request.entityId)) {
    body['EntityId'] = request.entityId;
  }
  if (!Util.isUnset(request.entityName)) {
    body['EntityName'] = request.entityName;
  }
  if (!Util.isUnset(request.entityRelationNumber)) {
    body['EntityRelationNumber'] = request.entityRelationNumber;
  }
  if (!Util.isUnset(request.extInfo)) {
    body['ExtInfo'] = request.extInfo;
  }
  if (!Util.isUnset(request.groupId)) {
    body['GroupId'] = request.groupId;
  }
  if (!Util.isUnset(request.instanceId)) {
    body['InstanceId'] = request.instanceId;
  }
  if (!Util.isUnset(request.serviceId)) {
    body['ServiceId'] = request.serviceId;
  }
  if (!Util.isUnset(request.uniqueId)) {
    body['UniqueId'] = request.uniqueId;
  }
  var req = new OpenApi.OpenApiRequest{ 
    body = OpenApiUtil.parseToMap(body),
  };
  var params = new OpenApi.Params{
    action = 'EditEntityRoute',
    version = '2020-07-30',
    protocol = 'HTTPS',
    pathname = '/',
    method = 'POST',
    authType = 'AK',
    style = 'RPC',
    reqBodyType = 'formData',
    bodyType = 'json',
  };
  return callApi(params, req, runtime);
}

async function editEntityRoute(request: EditEntityRouteRequest): EditEntityRouteResponse {
  var runtime = new Util.RuntimeOptions{};
  return editEntityRouteWithOptions(request, runtime);
}

model EnableRoleRequest {
  clientToken?: string(name='ClientToken'),
  instanceId?: string(name='InstanceId'),
  roleId?: long(name='RoleId'),
}

model EnableRoleResponseBody = {
  code?: string(name='Code'),
  message?: string(name='Message'),
  requestId?: string(name='RequestId'),
  success?: boolean(name='Success'),
}

model EnableRoleResponse = {
  headers: map[string]string(name='headers'),
  statusCode: int32(name='statusCode'),
  body: EnableRoleResponseBody(name='body'),
}

async function enableRoleWithOptions(request: EnableRoleRequest, runtime: Util.RuntimeOptions): EnableRoleResponse {
  Util.validateModel(request);
  var body : map[string]any = {};
  if (!Util.isUnset(request.clientToken)) {
    body['ClientToken'] = request.clientToken;
  }
  if (!Util.isUnset(request.instanceId)) {
    body['InstanceId'] = request.instanceId;
  }
  if (!Util.isUnset(request.roleId)) {
    body['RoleId'] = request.roleId;
  }
  var req = new OpenApi.OpenApiRequest{ 
    body = OpenApiUtil.parseToMap(body),
  };
  var params = new OpenApi.Params{
    action = 'EnableRole',
    version = '2020-07-30',
    protocol = 'HTTPS',
    pathname = '/',
    method = 'POST',
    authType = 'AK',
    style = 'RPC',
    reqBodyType = 'formData',
    bodyType = 'json',
  };
  return callApi(params, req, runtime);
}

async function enableRole(request: EnableRoleRequest): EnableRoleResponse {
  var runtime = new Util.RuntimeOptions{};
  return enableRoleWithOptions(request, runtime);
}

model ExecuteActivityRequest {
  activityCode?: string(name='ActivityCode'),
  activityForm?: string(name='ActivityForm'),
  clientToken?: string(name='ClientToken'),
  instanceId?: string(name='InstanceId'),
  operatorId?: long(name='OperatorId'),
  ticketId?: long(name='TicketId'),
}

model ExecuteActivityResponseBody = {
  code?: string(name='Code'),
  message?: string(name='Message'),
  requestId?: string(name='RequestId'),
  success?: boolean(name='Success'),
}

model ExecuteActivityResponse = {
  headers: map[string]string(name='headers'),
  statusCode: int32(name='statusCode'),
  body: ExecuteActivityResponseBody(name='body'),
}

async function executeActivityWithOptions(request: ExecuteActivityRequest, runtime: Util.RuntimeOptions): ExecuteActivityResponse {
  Util.validateModel(request);
  var body : map[string]any = {};
  if (!Util.isUnset(request.activityCode)) {
    body['ActivityCode'] = request.activityCode;
  }
  if (!Util.isUnset(request.activityForm)) {
    body['ActivityForm'] = request.activityForm;
  }
  if (!Util.isUnset(request.clientToken)) {
    body['ClientToken'] = request.clientToken;
  }
  if (!Util.isUnset(request.instanceId)) {
    body['InstanceId'] = request.instanceId;
  }
  if (!Util.isUnset(request.operatorId)) {
    body['OperatorId'] = request.operatorId;
  }
  if (!Util.isUnset(request.ticketId)) {
    body['TicketId'] = request.ticketId;
  }
  var req = new OpenApi.OpenApiRequest{ 
    body = OpenApiUtil.parseToMap(body),
  };
  var params = new OpenApi.Params{
    action = 'ExecuteActivity',
    version = '2020-07-30',
    protocol = 'HTTPS',
    pathname = '/',
    method = 'POST',
    authType = 'AK',
    style = 'RPC',
    reqBodyType = 'formData',
    bodyType = 'json',
  };
  return callApi(params, req, runtime);
}

async function executeActivity(request: ExecuteActivityRequest): ExecuteActivityResponse {
  var runtime = new Util.RuntimeOptions{};
  return executeActivityWithOptions(request, runtime);
}

model FetchCallRequest {
  accountName?: string(name='AccountName'),
  callId?: string(name='CallId'),
  clientToken?: string(name='ClientToken'),
  connectionId?: string(name='ConnectionId'),
  holdConnectionId?: string(name='HoldConnectionId'),
  instanceId?: string(name='InstanceId'),
  jobId?: string(name='JobId'),
}

model FetchCallResponseBody = {
  code?: string(name='Code'),
  message?: string(name='Message'),
  requestId?: string(name='RequestId'),
  success?: boolean(name='Success'),
}

model FetchCallResponse = {
  headers: map[string]string(name='headers'),
  statusCode: int32(name='statusCode'),
  body: FetchCallResponseBody(name='body'),
}

async function fetchCallWithOptions(request: FetchCallRequest, runtime: Util.RuntimeOptions): FetchCallResponse {
  Util.validateModel(request);
  var body : map[string]any = {};
  if (!Util.isUnset(request.accountName)) {
    body['AccountName'] = request.accountName;
  }
  if (!Util.isUnset(request.callId)) {
    body['CallId'] = request.callId;
  }
  if (!Util.isUnset(request.clientToken)) {
    body['ClientToken'] = request.clientToken;
  }
  if (!Util.isUnset(request.connectionId)) {
    body['ConnectionId'] = request.connectionId;
  }
  if (!Util.isUnset(request.holdConnectionId)) {
    body['HoldConnectionId'] = request.holdConnectionId;
  }
  if (!Util.isUnset(request.instanceId)) {
    body['InstanceId'] = request.instanceId;
  }
  if (!Util.isUnset(request.jobId)) {
    body['JobId'] = request.jobId;
  }
  var req = new OpenApi.OpenApiRequest{ 
    body = OpenApiUtil.parseToMap(body),
  };
  var params = new OpenApi.Params{
    action = 'FetchCall',
    version = '2020-07-30',
    protocol = 'HTTPS',
    pathname = '/',
    method = 'POST',
    authType = 'AK',
    style = 'RPC',
    reqBodyType = 'formData',
    bodyType = 'json',
  };
  return callApi(params, req, runtime);
}

async function fetchCall(request: FetchCallRequest): FetchCallResponse {
  var runtime = new Util.RuntimeOptions{};
  return fetchCallWithOptions(request, runtime);
}

model FinishHotlineServiceRequest {
  accountName?: string(name='AccountName'),
  clientToken?: string(name='ClientToken'),
  instanceId?: string(name='InstanceId'),
}

model FinishHotlineServiceResponseBody = {
  code?: string(name='Code'),
  message?: string(name='Message'),
  requestId?: string(name='RequestId'),
  success?: boolean(name='Success'),
}

model FinishHotlineServiceResponse = {
  headers: map[string]string(name='headers'),
  statusCode: int32(name='statusCode'),
  body: FinishHotlineServiceResponseBody(name='body'),
}

async function finishHotlineServiceWithOptions(request: FinishHotlineServiceRequest, runtime: Util.RuntimeOptions): FinishHotlineServiceResponse {
  Util.validateModel(request);
  var body : map[string]any = {};
  if (!Util.isUnset(request.accountName)) {
    body['AccountName'] = request.accountName;
  }
  if (!Util.isUnset(request.clientToken)) {
    body['ClientToken'] = request.clientToken;
  }
  if (!Util.isUnset(request.instanceId)) {
    body['InstanceId'] = request.instanceId;
  }
  var req = new OpenApi.OpenApiRequest{ 
    body = OpenApiUtil.parseToMap(body),
  };
  var params = new OpenApi.Params{
    action = 'FinishHotlineService',
    version = '2020-07-30',
    protocol = 'HTTPS',
    pathname = '/',
    method = 'POST',
    authType = 'AK',
    style = 'RPC',
    reqBodyType = 'formData',
    bodyType = 'json',
  };
  return callApi(params, req, runtime);
}

async function finishHotlineService(request: FinishHotlineServiceRequest): FinishHotlineServiceResponse {
  var runtime = new Util.RuntimeOptions{};
  return finishHotlineServiceWithOptions(request, runtime);
}

model FullSyncRequest {
  departmentInfos?: [ 
    {
      deptCode?: string(name='DeptCode'),
      deptHiding?: long(name='DeptHiding'),
      deptName?: string(name='DeptName'),
      deptOrder?: long(name='DeptOrder'),
      deptType?: string(name='DeptType'),
      ext?: string(name='Ext'),
      parentCode?: string(name='ParentCode'),
    }
  ](name='DepartmentInfos'),
  instanceId?: string(name='InstanceId'),
  orgId?: string(name='OrgId'),
  roleInfos?: [ 
    {
      groupId?: string(name='GroupId'),
      roleDesc?: string(name='RoleDesc'),
      roleId?: string(name='RoleId'),
      roleName?: string(name='RoleName'),
    }
  ](name='RoleInfos'),
  staffInfos?: [ 
    {
      depts?: [ 
        {
          id?: string(name='Id'),
          name?: string(name='Name'),
        }
      ](name='Depts'),
      email?: string(name='Email'),
      ext?: string(name='Ext'),
      isDeptAdmin?: long(name='IsDeptAdmin'),
      mobile?: string(name='Mobile'),
      name?: string(name='Name'),
      nick?: string(name='Nick'),
      position?: string(name='Position'),
      remark?: string(name='Remark'),
      roles?: [ 
        {
          id?: string(name='Id'),
          name?: string(name='Name'),
        }
      ](name='Roles'),
      status?: long(name='Status'),
      tel?: string(name='Tel'),
      userId?: string(name='UserId'),
      workPlace?: string(name='WorkPlace'),
    }
  ](name='StaffInfos'),
  syncType?: string(name='SyncType'),
}

model FullSyncResponseBody = {
  code?: string(name='Code'),
  data?: long(name='Data'),
  httpStatusCode?: long(name='HttpStatusCode'),
  message?: string(name='Message'),
  requestId?: string(name='RequestId'),
  success?: boolean(name='Success'),
}

model FullSyncResponse = {
  headers: map[string]string(name='headers'),
  statusCode: int32(name='statusCode'),
  body: FullSyncResponseBody(name='body'),
}

async function fullSyncWithOptions(request: FullSyncRequest, runtime: Util.RuntimeOptions): FullSyncResponse {
  Util.validateModel(request);
  var body : map[string]any = {};
  var bodyFlat : map[string]any = {};
  if (!Util.isUnset(request.departmentInfos)) {
    bodyFlat['DepartmentInfos'] = request.departmentInfos;
  }
  if (!Util.isUnset(request.instanceId)) {
    body['InstanceId'] = request.instanceId;
  }
  if (!Util.isUnset(request.orgId)) {
    body['OrgId'] = request.orgId;
  }
  if (!Util.isUnset(request.roleInfos)) {
    bodyFlat['RoleInfos'] = request.roleInfos;
  }
  if (!Util.isUnset(request.staffInfos)) {
    bodyFlat['StaffInfos'] = request.staffInfos;
  }
  if (!Util.isUnset(request.syncType)) {
    body['SyncType'] = request.syncType;
  }
  body = {
    ...body,
    ...OpenApiUtil.query(bodyFlat),
  };

  var req = new OpenApi.OpenApiRequest{ 
    body = OpenApiUtil.parseToMap(body),
  };
  var params = new OpenApi.Params{
    action = 'FullSync',
    version = '2020-07-30',
    protocol = 'HTTPS',
    pathname = '/',
    method = 'POST',
    authType = 'AK',
    style = 'RPC',
    reqBodyType = 'formData',
    bodyType = 'json',
  };
  return callApi(params, req, runtime);
}

async function fullSync(request: FullSyncRequest): FullSyncResponse {
  var runtime = new Util.RuntimeOptions{};
  return fullSyncWithOptions(request, runtime);
}

model GenerateWebSocketSignRequest {
  accountName?: string(name='AccountName'),
  clientToken?: string(name='ClientToken'),
  instanceId?: string(name='InstanceId'),
}

model GenerateWebSocketSignResponseBody = {
  code?: string(name='Code'),
  data?: string(name='Data'),
  httpStatusCode?: long(name='HttpStatusCode'),
  message?: string(name='Message'),
  requestId?: string(name='RequestId'),
  success?: boolean(name='Success'),
}

model GenerateWebSocketSignResponse = {
  headers: map[string]string(name='headers'),
  statusCode: int32(name='statusCode'),
  body: GenerateWebSocketSignResponseBody(name='body'),
}

async function generateWebSocketSignWithOptions(request: GenerateWebSocketSignRequest, runtime: Util.RuntimeOptions): GenerateWebSocketSignResponse {
  Util.validateModel(request);
  var body : map[string]any = {};
  if (!Util.isUnset(request.accountName)) {
    body['AccountName'] = request.accountName;
  }
  if (!Util.isUnset(request.clientToken)) {
    body['ClientToken'] = request.clientToken;
  }
  if (!Util.isUnset(request.instanceId)) {
    body['InstanceId'] = request.instanceId;
  }
  var req = new OpenApi.OpenApiRequest{ 
    body = OpenApiUtil.parseToMap(body),
  };
  var params = new OpenApi.Params{
    action = 'GenerateWebSocketSign',
    version = '2020-07-30',
    protocol = 'HTTPS',
    pathname = '/',
    method = 'POST',
    authType = 'AK',
    style = 'RPC',
    reqBodyType = 'formData',
    bodyType = 'json',
  };
  return callApi(params, req, runtime);
}

async function generateWebSocketSign(request: GenerateWebSocketSignRequest): GenerateWebSocketSignResponse {
  var runtime = new Util.RuntimeOptions{};
  return generateWebSocketSignWithOptions(request, runtime);
}

model GetAgentRequest {
  accountName?: string(name='AccountName'),
  clientToken?: string(name='ClientToken'),
  instanceId?: string(name='InstanceId'),
}

model GetAgentResponseBody = {
  code?: string(name='Code'),
  data?: {
    accountName?: string(name='AccountName'),
    agentId?: long(name='AgentId'),
    displayName?: string(name='DisplayName'),
    groupList?: [ 
      {
        channelType?: int32(name='ChannelType'),
        description?: string(name='Description'),
        displayName?: string(name='DisplayName'),
        name?: string(name='Name'),
        skillGroupId?: long(name='SkillGroupId'),
      }
    ](name='GroupList'),
    status?: int32(name='Status'),
    tenantId?: long(name='TenantId'),
  }(name='Data'),
  httpStatusCode?: long(name='HttpStatusCode'),
  message?: string(name='Message'),
  requestId?: string(name='RequestId'),
  success?: boolean(name='Success'),
}

model GetAgentResponse = {
  headers: map[string]string(name='headers'),
  statusCode: int32(name='statusCode'),
  body: GetAgentResponseBody(name='body'),
}

async function getAgentWithOptions(request: GetAgentRequest, runtime: Util.RuntimeOptions): GetAgentResponse {
  Util.validateModel(request);
  var query = OpenApiUtil.query(Util.toMap(request));
  var req = new OpenApi.OpenApiRequest{ 
    query = OpenApiUtil.query(query),
  };
  var params = new OpenApi.Params{
    action = 'GetAgent',
    version = '2020-07-30',
    protocol = 'HTTPS',
    pathname = '/',
    method = 'GET',
    authType = 'AK',
    style = 'RPC',
    reqBodyType = 'formData',
    bodyType = 'json',
  };
  return callApi(params, req, runtime);
}

async function getAgent(request: GetAgentRequest): GetAgentResponse {
  var runtime = new Util.RuntimeOptions{};
  return getAgentWithOptions(request, runtime);
}

model GetAuthInfoRequest {
  appKey?: string(name='AppKey'),
  foreignId?: string(name='ForeignId'),
  instanceId?: string(name='InstanceId'),
}

model GetAuthInfoResponseBody = {
  code?: string(name='Code'),
  data?: {
    app?: string(name='App'),
    appKey?: string(name='AppKey'),
    appName?: string(name='AppName'),
    code?: string(name='Code'),
    sessionId?: string(name='SessionId'),
    tenantId?: string(name='TenantId'),
    time?: long(name='Time'),
    userId?: string(name='UserId'),
    userName?: string(name='UserName'),
  }(name='Data'),
  message?: string(name='Message'),
  requestId?: string(name='RequestId'),
  success?: boolean(name='Success'),
}

model GetAuthInfoResponse = {
  headers: map[string]string(name='headers'),
  statusCode: int32(name='statusCode'),
  body: GetAuthInfoResponseBody(name='body'),
}

async function getAuthInfoWithOptions(request: GetAuthInfoRequest, runtime: Util.RuntimeOptions): GetAuthInfoResponse {
  Util.validateModel(request);
  var query = {};
  if (!Util.isUnset(request.appKey)) {
    query['AppKey'] = request.appKey;
  }
  if (!Util.isUnset(request.foreignId)) {
    query['ForeignId'] = request.foreignId;
  }
  if (!Util.isUnset(request.instanceId)) {
    query['InstanceId'] = request.instanceId;
  }
  var req = new OpenApi.OpenApiRequest{ 
    query = OpenApiUtil.query(query),
  };
  var params = new OpenApi.Params{
    action = 'GetAuthInfo',
    version = '2020-07-30',
    protocol = 'HTTPS',
    pathname = '/',
    method = 'POST',
    authType = 'AK',
    style = 'RPC',
    reqBodyType = 'formData',
    bodyType = 'json',
  };
  return callApi(params, req, runtime);
}

async function getAuthInfo(request: GetAuthInfoRequest): GetAuthInfoResponse {
  var runtime = new Util.RuntimeOptions{};
  return getAuthInfoWithOptions(request, runtime);
}

model GetCMSIdByForeignIdRequest {
  foreignId?: string(name='ForeignId'),
  instanceId?: string(name='InstanceId'),
  nick?: string(name='Nick'),
  sourceId?: long(name='SourceId'),
}

model GetCMSIdByForeignIdResponseBody = {
  code?: string(name='Code'),
  data?: {
    anonymity?: boolean(name='Anonymity'),
    avatar?: string(name='Avatar'),
    customerTypeId?: int32(name='CustomerTypeId'),
    foreignId?: string(name='ForeignId'),
    gender?: string(name='Gender'),
    nick?: string(name='Nick'),
    phone?: string(name='Phone'),
    status?: int32(name='Status'),
    userId?: string(name='UserId'),
  }(name='Data'),
  message?: string(name='Message'),
  requestId?: string(name='RequestId'),
  success?: boolean(name='Success'),
}

model GetCMSIdByForeignIdResponse = {
  headers: map[string]string(name='headers'),
  statusCode: int32(name='statusCode'),
  body: GetCMSIdByForeignIdResponseBody(name='body'),
}

async function getCMSIdByForeignIdWithOptions(request: GetCMSIdByForeignIdRequest, runtime: Util.RuntimeOptions): GetCMSIdByForeignIdResponse {
  Util.validateModel(request);
  var query = {};
  if (!Util.isUnset(request.foreignId)) {
    query['ForeignId'] = request.foreignId;
  }
  if (!Util.isUnset(request.instanceId)) {
    query['InstanceId'] = request.instanceId;
  }
  if (!Util.isUnset(request.nick)) {
    query['Nick'] = request.nick;
  }
  if (!Util.isUnset(request.sourceId)) {
    query['SourceId'] = request.sourceId;
  }
  var req = new OpenApi.OpenApiRequest{ 
    query = OpenApiUtil.query(query),
  };
  var params = new OpenApi.Params{
    action = 'GetCMSIdByForeignId',
    version = '2020-07-30',
    protocol = 'HTTPS',
    pathname = '/',
    method = 'POST',
    authType = 'AK',
    style = 'RPC',
    reqBodyType = 'formData',
    bodyType = 'json',
  };
  return callApi(params, req, runtime);
}

async function getCMSIdByForeignId(request: GetCMSIdByForeignIdRequest): GetCMSIdByForeignIdResponse {
  var runtime = new Util.RuntimeOptions{};
  return getCMSIdByForeignIdWithOptions(request, runtime);
}

model GetCallsPerDayRequest {
  dataId?: string(name='DataId'),
  dataIdEnd?: string(name='DataIdEnd'),
  dataIdStart?: string(name='DataIdStart'),
  havePhoneNumbers?: string(name='HavePhoneNumbers'),
  hourId?: string(name='HourId'),
  instanceId?: string(name='InstanceId'),
  minuteId?: string(name='MinuteId'),
  pageNo?: long(name='PageNo'),
  pageSize?: long(name='PageSize'),
  phoneNumbers?: string(name='PhoneNumbers'),
}

model GetCallsPerDayResponseBody = {
  code?: string(name='Code'),
  data?: {
    callsPerdayResponseList?: [ 
      {
        callInCnt?: string(name='CallInCnt'),
        callOutCnt?: string(name='CallOutCnt'),
        dataId?: string(name='DataId'),
        hourId?: string(name='HourId'),
        minuteId?: string(name='MinuteId'),
        phoneNum?: string(name='PhoneNum'),
        tenantId?: string(name='TenantId'),
        tenantName?: string(name='TenantName'),
      }
    ](name='CallsPerdayResponseList'),
    pageNo?: string(name='PageNo'),
    pageSize?: long(name='PageSize'),
    totalNum?: long(name='TotalNum'),
  }(name='Data'),
  message?: string(name='Message'),
  requestId?: string(name='RequestId'),
  success?: string(name='Success'),
}

model GetCallsPerDayResponse = {
  headers: map[string]string(name='headers'),
  statusCode: int32(name='statusCode'),
  body: GetCallsPerDayResponseBody(name='body'),
}

async function getCallsPerDayWithOptions(request: GetCallsPerDayRequest, runtime: Util.RuntimeOptions): GetCallsPerDayResponse {
  Util.validateModel(request);
  var query = OpenApiUtil.query(Util.toMap(request));
  var req = new OpenApi.OpenApiRequest{ 
    query = OpenApiUtil.query(query),
  };
  var params = new OpenApi.Params{
    action = 'GetCallsPerDay',
    version = '2020-07-30',
    protocol = 'HTTPS',
    pathname = '/',
    method = 'GET',
    authType = 'AK',
    style = 'RPC',
    reqBodyType = 'formData',
    bodyType = 'json',
  };
  return callApi(params, req, runtime);
}

async function getCallsPerDay(request: GetCallsPerDayRequest): GetCallsPerDayResponse {
  var runtime = new Util.RuntimeOptions{};
  return getCallsPerDayWithOptions(request, runtime);
}

model GetEntityRouteRequest {
  entityBizCode?: string(name='EntityBizCode'),
  entityId?: string(name='EntityId'),
  entityName?: string(name='EntityName'),
  entityRelationNumber?: string(name='EntityRelationNumber'),
  instanceId?: string(name='InstanceId'),
  uniqueId?: long(name='UniqueId'),
}

model GetEntityRouteResponseBody = {
  code?: string(name='Code'),
  data?: {
    departmentId?: string(name='DepartmentId'),
    entityBizCode?: string(name='EntityBizCode'),
    entityBizCodeType?: string(name='EntityBizCodeType'),
    entityId?: string(name='EntityId'),
    entityName?: string(name='EntityName'),
    entityRelationNumber?: string(name='EntityRelationNumber'),
    extInfo?: string(name='ExtInfo'),
    groupId?: long(name='GroupId'),
    serviceId?: long(name='ServiceId'),
    uniqueId?: long(name='UniqueId'),
  }(name='Data'),
  message?: string(name='Message'),
  requestId?: string(name='RequestId'),
  success?: boolean(name='Success'),
}

model GetEntityRouteResponse = {
  headers: map[string]string(name='headers'),
  statusCode: int32(name='statusCode'),
  body: GetEntityRouteResponseBody(name='body'),
}

async function getEntityRouteWithOptions(request: GetEntityRouteRequest, runtime: Util.RuntimeOptions): GetEntityRouteResponse {
  Util.validateModel(request);
  var body : map[string]any = {};
  if (!Util.isUnset(request.entityBizCode)) {
    body['EntityBizCode'] = request.entityBizCode;
  }
  if (!Util.isUnset(request.entityId)) {
    body['EntityId'] = request.entityId;
  }
  if (!Util.isUnset(request.entityName)) {
    body['EntityName'] = request.entityName;
  }
  if (!Util.isUnset(request.entityRelationNumber)) {
    body['EntityRelationNumber'] = request.entityRelationNumber;
  }
  if (!Util.isUnset(request.instanceId)) {
    body['InstanceId'] = request.instanceId;
  }
  if (!Util.isUnset(request.uniqueId)) {
    body['UniqueId'] = request.uniqueId;
  }
  var req = new OpenApi.OpenApiRequest{ 
    body = OpenApiUtil.parseToMap(body),
  };
  var params = new OpenApi.Params{
    action = 'GetEntityRoute',
    version = '2020-07-30',
    protocol = 'HTTPS',
    pathname = '/',
    method = 'POST',
    authType = 'AK',
    style = 'RPC',
    reqBodyType = 'formData',
    bodyType = 'json',
  };
  return callApi(params, req, runtime);
}

async function getEntityRoute(request: GetEntityRouteRequest): GetEntityRouteResponse {
  var runtime = new Util.RuntimeOptions{};
  return getEntityRouteWithOptions(request, runtime);
}

model GetEntityRouteListRequest {
  entityName?: string(name='EntityName'),
  entityRelationNumber?: string(name='EntityRelationNumber'),
  instanceId?: string(name='InstanceId'),
  pageNo?: int32(name='PageNo'),
  pageSize?: int32(name='PageSize'),
}

model GetEntityRouteListResponseBody = {
  code?: string(name='Code'),
  data?: {
    entityRouteList?: [ 
      {
        departmentId?: string(name='DepartmentId'),
        entityBizCode?: string(name='EntityBizCode'),
        entityBizCodeType?: string(name='EntityBizCodeType'),
        entityId?: string(name='EntityId'),
        entityName?: string(name='EntityName'),
        entityRelationNumber?: string(name='EntityRelationNumber'),
        extInfo?: string(name='ExtInfo'),
        groupId?: string(name='GroupId'),
        serviceId?: string(name='ServiceId'),
        uniqueId?: long(name='UniqueId'),
      }
    ](name='EntityRouteList'),
    pageNo?: int32(name='PageNo'),
    pageSize?: int32(name='PageSize'),
    total?: long(name='Total'),
  }(name='Data'),
  message?: string(name='Message'),
  requestId?: string(name='RequestId'),
  success?: boolean(name='Success'),
}

model GetEntityRouteListResponse = {
  headers: map[string]string(name='headers'),
  statusCode: int32(name='statusCode'),
  body: GetEntityRouteListResponseBody(name='body'),
}

async function getEntityRouteListWithOptions(request: GetEntityRouteListRequest, runtime: Util.RuntimeOptions): GetEntityRouteListResponse {
  Util.validateModel(request);
  var body : map[string]any = {};
  if (!Util.isUnset(request.entityName)) {
    body['EntityName'] = request.entityName;
  }
  if (!Util.isUnset(request.entityRelationNumber)) {
    body['EntityRelationNumber'] = request.entityRelationNumber;
  }
  if (!Util.isUnset(request.instanceId)) {
    body['InstanceId'] = request.instanceId;
  }
  if (!Util.isUnset(request.pageNo)) {
    body['PageNo'] = request.pageNo;
  }
  if (!Util.isUnset(request.pageSize)) {
    body['PageSize'] = request.pageSize;
  }
  var req = new OpenApi.OpenApiRequest{ 
    body = OpenApiUtil.parseToMap(body),
  };
  var params = new OpenApi.Params{
    action = 'GetEntityRouteList',
    version = '2020-07-30',
    protocol = 'HTTPS',
    pathname = '/',
    method = 'POST',
    authType = 'AK',
    style = 'RPC',
    reqBodyType = 'formData',
    bodyType = 'json',
  };
  return callApi(params, req, runtime);
}

async function getEntityRouteList(request: GetEntityRouteListRequest): GetEntityRouteListResponse {
  var runtime = new Util.RuntimeOptions{};
  return getEntityRouteListWithOptions(request, runtime);
}

model GetEntityTagRelationRequest {
  entityId?: string(name='EntityId'),
  entityType?: string(name='EntityType'),
  instanceId?: string(name='InstanceId'),
}

model GetEntityTagRelationResponseBody = {
  code?: string(name='Code'),
  data?: [ 
    {
      entityId?: string(name='EntityId'),
      entityType?: string(name='EntityType'),
      tagCode?: string(name='TagCode'),
      tagGroupCode?: string(name='TagGroupCode'),
      tagGroupName?: string(name='TagGroupName'),
      tagName?: string(name='TagName'),
    }
  ](name='Data'),
  message?: string(name='Message'),
  requestId?: string(name='RequestId'),
  success?: boolean(name='Success'),
}

model GetEntityTagRelationResponse = {
  headers: map[string]string(name='headers'),
  statusCode: int32(name='statusCode'),
  body: GetEntityTagRelationResponseBody(name='body'),
}

async function getEntityTagRelationWithOptions(request: GetEntityTagRelationRequest, runtime: Util.RuntimeOptions): GetEntityTagRelationResponse {
  Util.validateModel(request);
  var body : map[string]any = {};
  if (!Util.isUnset(request.entityId)) {
    body['EntityId'] = request.entityId;
  }
  if (!Util.isUnset(request.entityType)) {
    body['EntityType'] = request.entityType;
  }
  if (!Util.isUnset(request.instanceId)) {
    body['InstanceId'] = request.instanceId;
  }
  var req = new OpenApi.OpenApiRequest{ 
    body = OpenApiUtil.parseToMap(body),
  };
  var params = new OpenApi.Params{
    action = 'GetEntityTagRelation',
    version = '2020-07-30',
    protocol = 'HTTPS',
    pathname = '/',
    method = 'POST',
    authType = 'AK',
    style = 'RPC',
    reqBodyType = 'formData',
    bodyType = 'json',
  };
  return callApi(params, req, runtime);
}

async function getEntityTagRelation(request: GetEntityTagRelationRequest): GetEntityTagRelationResponse {
  var runtime = new Util.RuntimeOptions{};
  return getEntityTagRelationWithOptions(request, runtime);
}

model GetForeignIdByCMSIdRequest {
  instanceId?: string(name='InstanceId'),
  userId?: long(name='UserId'),
}

model GetForeignIdByCMSIdResponseBody = {
  code?: string(name='Code'),
  data?: {
    anonymity?: boolean(name='Anonymity'),
    avatar?: string(name='Avatar'),
    customerTypeId?: int32(name='CustomerTypeId'),
    foreignId?: string(name='ForeignId'),
    gender?: string(name='Gender'),
    nick?: string(name='Nick'),
    phone?: string(name='Phone'),
    status?: int32(name='Status'),
    userId?: string(name='UserId'),
  }(name='Data'),
  message?: string(name='Message'),
  requestId?: string(name='RequestId'),
  success?: boolean(name='Success'),
}

model GetForeignIdByCMSIdResponse = {
  headers: map[string]string(name='headers'),
  statusCode: int32(name='statusCode'),
  body: GetForeignIdByCMSIdResponseBody(name='body'),
}

async function getForeignIdByCMSIdWithOptions(request: GetForeignIdByCMSIdRequest, runtime: Util.RuntimeOptions): GetForeignIdByCMSIdResponse {
  Util.validateModel(request);
  var query = {};
  if (!Util.isUnset(request.instanceId)) {
    query['InstanceId'] = request.instanceId;
  }
  if (!Util.isUnset(request.userId)) {
    query['UserId'] = request.userId;
  }
  var req = new OpenApi.OpenApiRequest{ 
    query = OpenApiUtil.query(query),
  };
  var params = new OpenApi.Params{
    action = 'GetForeignIdByCMSId',
    version = '2020-07-30',
    protocol = 'HTTPS',
    pathname = '/',
    method = 'POST',
    authType = 'AK',
    style = 'RPC',
    reqBodyType = 'formData',
    bodyType = 'json',
  };
  return callApi(params, req, runtime);
}

async function getForeignIdByCMSId(request: GetForeignIdByCMSIdRequest): GetForeignIdByCMSIdResponse {
  var runtime = new Util.RuntimeOptions{};
  return getForeignIdByCMSIdWithOptions(request, runtime);
}

model GetGrantedRoleIdsRequest {
  accountName?: string(name='AccountName'),
  clientToken?: string(name='ClientToken'),
  instanceId?: string(name='InstanceId'),
}

model GetGrantedRoleIdsResponseBody = {
  code?: string(name='Code'),
  data?: [ long ](name='Data'),
  httpStatusCode?: long(name='HttpStatusCode'),
  message?: string(name='Message'),
  requestId?: string(name='RequestId'),
  success?: boolean(name='Success'),
}

model GetGrantedRoleIdsResponse = {
  headers: map[string]string(name='headers'),
  statusCode: int32(name='statusCode'),
  body: GetGrantedRoleIdsResponseBody(name='body'),
}

async function getGrantedRoleIdsWithOptions(request: GetGrantedRoleIdsRequest, runtime: Util.RuntimeOptions): GetGrantedRoleIdsResponse {
  Util.validateModel(request);
  var query = OpenApiUtil.query(Util.toMap(request));
  var req = new OpenApi.OpenApiRequest{ 
    query = OpenApiUtil.query(query),
  };
  var params = new OpenApi.Params{
    action = 'GetGrantedRoleIds',
    version = '2020-07-30',
    protocol = 'HTTPS',
    pathname = '/',
    method = 'GET',
    authType = 'AK',
    style = 'RPC',
    reqBodyType = 'formData',
    bodyType = 'json',
  };
  return callApi(params, req, runtime);
}

async function getGrantedRoleIds(request: GetGrantedRoleIdsRequest): GetGrantedRoleIdsResponse {
  var runtime = new Util.RuntimeOptions{};
  return getGrantedRoleIdsWithOptions(request, runtime);
}

model GetGrantedRoleIdsByServicerIdRequest {
  instanceId?: string(name='InstanceId'),
  servicerId?: long(name='ServicerId'),
}

model GetGrantedRoleIdsByServicerIdResponseBody = {
  code?: string(name='Code'),
  data?: [ long ](name='Data'),
  httpStatusCode?: string(name='HttpStatusCode'),
  message?: string(name='Message'),
  requestId?: string(name='RequestId'),
  success?: string(name='Success'),
}

model GetGrantedRoleIdsByServicerIdResponse = {
  headers: map[string]string(name='headers'),
  statusCode: int32(name='statusCode'),
  body: GetGrantedRoleIdsByServicerIdResponseBody(name='body'),
}

async function getGrantedRoleIdsByServicerIdWithOptions(request: GetGrantedRoleIdsByServicerIdRequest, runtime: Util.RuntimeOptions): GetGrantedRoleIdsByServicerIdResponse {
  Util.validateModel(request);
  var query = {};
  if (!Util.isUnset(request.instanceId)) {
    query['InstanceId'] = request.instanceId;
  }
  if (!Util.isUnset(request.servicerId)) {
    query['ServicerId'] = request.servicerId;
  }
  var req = new OpenApi.OpenApiRequest{ 
    query = OpenApiUtil.query(query),
  };
  var params = new OpenApi.Params{
    action = 'GetGrantedRoleIdsByServicerId',
    version = '2020-07-30',
    protocol = 'HTTPS',
    pathname = '/',
    method = 'POST',
    authType = 'AK',
    style = 'RPC',
    reqBodyType = 'formData',
    bodyType = 'json',
  };
  return callApi(params, req, runtime);
}

async function getGrantedRoleIdsByServicerId(request: GetGrantedRoleIdsByServicerIdRequest): GetGrantedRoleIdsByServicerIdResponse {
  var runtime = new Util.RuntimeOptions{};
  return getGrantedRoleIdsByServicerIdWithOptions(request, runtime);
}

model GetHotlineAgentDetailRequest {
  accountName?: string(name='AccountName'),
  clientToken?: string(name='ClientToken'),
  instanceId?: string(name='InstanceId'),
}

model GetHotlineAgentDetailResponseBody = {
  code?: string(name='Code'),
  data?: {
    agentId?: long(name='AgentId'),
    agentStatus?: int32(name='AgentStatus'),
    agentStatusCode?: string(name='AgentStatusCode'),
    assigned?: boolean(name='Assigned'),
    restType?: int32(name='RestType'),
    tenantId?: long(name='TenantId'),
    token?: string(name='Token'),
  }(name='Data'),
  httpStatusCode?: long(name='HttpStatusCode'),
  message?: string(name='Message'),
  requestId?: string(name='RequestId'),
  success?: boolean(name='Success'),
}

model GetHotlineAgentDetailResponse = {
  headers: map[string]string(name='headers'),
  statusCode: int32(name='statusCode'),
  body: GetHotlineAgentDetailResponseBody(name='body'),
}

async function getHotlineAgentDetailWithOptions(request: GetHotlineAgentDetailRequest, runtime: Util.RuntimeOptions): GetHotlineAgentDetailResponse {
  Util.validateModel(request);
  var query = OpenApiUtil.query(Util.toMap(request));
  var req = new OpenApi.OpenApiRequest{ 
    query = OpenApiUtil.query(query),
  };
  var params = new OpenApi.Params{
    action = 'GetHotlineAgentDetail',
    version = '2020-07-30',
    protocol = 'HTTPS',
    pathname = '/',
    method = 'GET',
    authType = 'AK',
    style = 'RPC',
    reqBodyType = 'formData',
    bodyType = 'json',
  };
  return callApi(params, req, runtime);
}

async function getHotlineAgentDetail(request: GetHotlineAgentDetailRequest): GetHotlineAgentDetailResponse {
  var runtime = new Util.RuntimeOptions{};
  return getHotlineAgentDetailWithOptions(request, runtime);
}

model GetHotlineAgentDetailReportRequest {
  currentPage?: int32(name='CurrentPage'),
  depIds?: [ long ](name='DepIds'),
  endDate?: long(name='EndDate'),
  groupIds?: [ long ](name='GroupIds'),
  instanceId?: string(name='InstanceId'),
  pageSize?: int32(name='PageSize'),
  startDate?: long(name='StartDate'),
}

model GetHotlineAgentDetailReportResponseBody = {
  code?: string(name='Code'),
  data?: {
    columns?: [ 
      {
        key?: string(name='Key'),
        title?: string(name='Title'),
      }
    ](name='Columns'),
    page?: int32(name='Page'),
    pageSize?: int32(name='PageSize'),
    rows?: [  map[string]any ](name='Rows'),
    total?: int32(name='Total'),
  }(name='Data'),
  message?: string(name='Message'),
  requestId?: string(name='RequestId'),
  success?: string(name='Success'),
}

model GetHotlineAgentDetailReportResponse = {
  headers: map[string]string(name='headers'),
  statusCode: int32(name='statusCode'),
  body: GetHotlineAgentDetailReportResponseBody(name='body'),
}

async function getHotlineAgentDetailReportWithOptions(request: GetHotlineAgentDetailReportRequest, runtime: Util.RuntimeOptions): GetHotlineAgentDetailReportResponse {
  Util.validateModel(request);
  var query = {};
  if (!Util.isUnset(request.currentPage)) {
    query['CurrentPage'] = request.currentPage;
  }
  if (!Util.isUnset(request.depIds)) {
    query['DepIds'] = request.depIds;
  }
  if (!Util.isUnset(request.endDate)) {
    query['EndDate'] = request.endDate;
  }
  if (!Util.isUnset(request.groupIds)) {
    query['GroupIds'] = request.groupIds;
  }
  if (!Util.isUnset(request.instanceId)) {
    query['InstanceId'] = request.instanceId;
  }
  if (!Util.isUnset(request.pageSize)) {
    query['PageSize'] = request.pageSize;
  }
  if (!Util.isUnset(request.startDate)) {
    query['StartDate'] = request.startDate;
  }
  var req = new OpenApi.OpenApiRequest{ 
    query = OpenApiUtil.query(query),
  };
  var params = new OpenApi.Params{
    action = 'GetHotlineAgentDetailReport',
    version = '2020-07-30',
    protocol = 'HTTPS',
    pathname = '/',
    method = 'POST',
    authType = 'AK',
    style = 'RPC',
    reqBodyType = 'formData',
    bodyType = 'json',
  };
  return callApi(params, req, runtime);
}

async function getHotlineAgentDetailReport(request: GetHotlineAgentDetailReportRequest): GetHotlineAgentDetailReportResponse {
  var runtime = new Util.RuntimeOptions{};
  return getHotlineAgentDetailReportWithOptions(request, runtime);
}

model GetHotlineAgentStatusRequest {
  accountName?: string(name='AccountName'),
  instanceId?: string(name='InstanceId'),
}

model GetHotlineAgentStatusResponseBody = {
  code?: string(name='Code'),
  data?: string(name='Data'),
  httpStatusCode?: long(name='HttpStatusCode'),
  message?: string(name='Message'),
  requestId?: string(name='RequestId'),
  success?: boolean(name='Success'),
}

model GetHotlineAgentStatusResponse = {
  headers: map[string]string(name='headers'),
  statusCode: int32(name='statusCode'),
  body: GetHotlineAgentStatusResponseBody(name='body'),
}

async function getHotlineAgentStatusWithOptions(request: GetHotlineAgentStatusRequest, runtime: Util.RuntimeOptions): GetHotlineAgentStatusResponse {
  Util.validateModel(request);
  var body : map[string]any = {};
  if (!Util.isUnset(request.accountName)) {
    body['AccountName'] = request.accountName;
  }
  if (!Util.isUnset(request.instanceId)) {
    body['InstanceId'] = request.instanceId;
  }
  var req = new OpenApi.OpenApiRequest{ 
    body = OpenApiUtil.parseToMap(body),
  };
  var params = new OpenApi.Params{
    action = 'GetHotlineAgentStatus',
    version = '2020-07-30',
    protocol = 'HTTPS',
    pathname = '/',
    method = 'POST',
    authType = 'AK',
    style = 'RPC',
    reqBodyType = 'formData',
    bodyType = 'json',
  };
  return callApi(params, req, runtime);
}

async function getHotlineAgentStatus(request: GetHotlineAgentStatusRequest): GetHotlineAgentStatusResponse {
  var runtime = new Util.RuntimeOptions{};
  return getHotlineAgentStatusWithOptions(request, runtime);
}

model GetHotlineGroupDetailReportRequest {
  currentPage?: int32(name='CurrentPage'),
  depIds?: [ long ](name='DepIds'),
  endDate?: long(name='EndDate'),
  groupIds?: [ long ](name='GroupIds'),
  instanceId?: string(name='InstanceId'),
  pageSize?: int32(name='PageSize'),
  startDate?: long(name='StartDate'),
}

model GetHotlineGroupDetailReportResponseBody = {
  code?: string(name='Code'),
  data?: {
    columns?: [ 
      {
        key?: string(name='Key'),
        title?: string(name='Title'),
      }
    ](name='Columns'),
    page?: int32(name='Page'),
    pageSize?: int32(name='PageSize'),
    rows?: [  map[string]any ](name='Rows'),
    total?: int32(name='Total'),
  }(name='Data'),
  message?: string(name='Message'),
  requestId?: string(name='RequestId'),
  success?: string(name='Success'),
}

model GetHotlineGroupDetailReportResponse = {
  headers: map[string]string(name='headers'),
  statusCode: int32(name='statusCode'),
  body: GetHotlineGroupDetailReportResponseBody(name='body'),
}

async function getHotlineGroupDetailReportWithOptions(request: GetHotlineGroupDetailReportRequest, runtime: Util.RuntimeOptions): GetHotlineGroupDetailReportResponse {
  Util.validateModel(request);
  var query = {};
  if (!Util.isUnset(request.currentPage)) {
    query['CurrentPage'] = request.currentPage;
  }
  if (!Util.isUnset(request.depIds)) {
    query['DepIds'] = request.depIds;
  }
  if (!Util.isUnset(request.endDate)) {
    query['EndDate'] = request.endDate;
  }
  if (!Util.isUnset(request.groupIds)) {
    query['GroupIds'] = request.groupIds;
  }
  if (!Util.isUnset(request.instanceId)) {
    query['InstanceId'] = request.instanceId;
  }
  if (!Util.isUnset(request.pageSize)) {
    query['PageSize'] = request.pageSize;
  }
  if (!Util.isUnset(request.startDate)) {
    query['StartDate'] = request.startDate;
  }
  var req = new OpenApi.OpenApiRequest{ 
    query = OpenApiUtil.query(query),
  };
  var params = new OpenApi.Params{
    action = 'GetHotlineGroupDetailReport',
    version = '2020-07-30',
    protocol = 'HTTPS',
    pathname = '/',
    method = 'POST',
    authType = 'AK',
    style = 'RPC',
    reqBodyType = 'formData',
    bodyType = 'json',
  };
  return callApi(params, req, runtime);
}

async function getHotlineGroupDetailReport(request: GetHotlineGroupDetailReportRequest): GetHotlineGroupDetailReportResponse {
  var runtime = new Util.RuntimeOptions{};
  return getHotlineGroupDetailReportWithOptions(request, runtime);
}

model GetHotlineWaitingNumberRequest {
  accountName?: string(name='AccountName'),
  clientToken?: string(name='ClientToken'),
  instanceId?: string(name='InstanceId'),
}

model GetHotlineWaitingNumberResponseBody = {
  code?: string(name='Code'),
  data?: long(name='Data'),
  httpStatusCode?: long(name='HttpStatusCode'),
  message?: string(name='Message'),
  requestId?: string(name='RequestId'),
  success?: boolean(name='Success'),
}

model GetHotlineWaitingNumberResponse = {
  headers: map[string]string(name='headers'),
  statusCode: int32(name='statusCode'),
  body: GetHotlineWaitingNumberResponseBody(name='body'),
}

async function getHotlineWaitingNumberWithOptions(request: GetHotlineWaitingNumberRequest, runtime: Util.RuntimeOptions): GetHotlineWaitingNumberResponse {
  Util.validateModel(request);
  var query = OpenApiUtil.query(Util.toMap(request));
  var req = new OpenApi.OpenApiRequest{ 
    query = OpenApiUtil.query(query),
  };
  var params = new OpenApi.Params{
    action = 'GetHotlineWaitingNumber',
    version = '2020-07-30',
    protocol = 'HTTPS',
    pathname = '/',
    method = 'GET',
    authType = 'AK',
    style = 'RPC',
    reqBodyType = 'formData',
    bodyType = 'json',
  };
  return callApi(params, req, runtime);
}

async function getHotlineWaitingNumber(request: GetHotlineWaitingNumberRequest): GetHotlineWaitingNumberResponse {
  var runtime = new Util.RuntimeOptions{};
  return getHotlineWaitingNumberWithOptions(request, runtime);
}

model GetNumLocationRequest {
  clientToken?: string(name='ClientToken'),
  instanceId?: string(name='InstanceId'),
  phoneNum?: string(name='PhoneNum'),
}

model GetNumLocationResponseBody = {
  code?: string(name='Code'),
  data?: string(name='Data'),
  httpStatusCode?: long(name='HttpStatusCode'),
  message?: string(name='Message'),
  requestId?: string(name='RequestId'),
  success?: boolean(name='Success'),
}

model GetNumLocationResponse = {
  headers: map[string]string(name='headers'),
  statusCode: int32(name='statusCode'),
  body: GetNumLocationResponseBody(name='body'),
}

async function getNumLocationWithOptions(request: GetNumLocationRequest, runtime: Util.RuntimeOptions): GetNumLocationResponse {
  Util.validateModel(request);
  var query = OpenApiUtil.query(Util.toMap(request));
  var req = new OpenApi.OpenApiRequest{ 
    query = OpenApiUtil.query(query),
  };
  var params = new OpenApi.Params{
    action = 'GetNumLocation',
    version = '2020-07-30',
    protocol = 'HTTPS',
    pathname = '/',
    method = 'GET',
    authType = 'AK',
    style = 'RPC',
    reqBodyType = 'formData',
    bodyType = 'json',
  };
  return callApi(params, req, runtime);
}

async function getNumLocation(request: GetNumLocationRequest): GetNumLocationResponse {
  var runtime = new Util.RuntimeOptions{};
  return getNumLocationWithOptions(request, runtime);
}

model GetOutbounNumListRequest {
  accountName?: string(name='AccountName'),
  clientToken?: string(name='ClientToken'),
  instanceId?: string(name='InstanceId'),
}

model GetOutbounNumListResponseBody = {
  code?: string(name='Code'),
  data?: {
    num?: [ 
      {
        description?: string(name='Description'),
        type?: int32(name='Type'),
        value?: string(name='Value'),
      }
    ](name='Num'),
    numGroup?: [ 
      {
        description?: string(name='Description'),
        type?: int32(name='Type'),
        value?: string(name='Value'),
      }
    ](name='NumGroup'),
  }(name='Data'),
  httpStatusCode?: long(name='HttpStatusCode'),
  message?: string(name='Message'),
  requestId?: string(name='RequestId'),
  success?: boolean(name='Success'),
}

model GetOutbounNumListResponse = {
  headers: map[string]string(name='headers'),
  statusCode: int32(name='statusCode'),
  body: GetOutbounNumListResponseBody(name='body'),
}

async function getOutbounNumListWithOptions(request: GetOutbounNumListRequest, runtime: Util.RuntimeOptions): GetOutbounNumListResponse {
  Util.validateModel(request);
  var body : map[string]any = {};
  if (!Util.isUnset(request.accountName)) {
    body['AccountName'] = request.accountName;
  }
  if (!Util.isUnset(request.clientToken)) {
    body['ClientToken'] = request.clientToken;
  }
  if (!Util.isUnset(request.instanceId)) {
    body['InstanceId'] = request.instanceId;
  }
  var req = new OpenApi.OpenApiRequest{ 
    body = OpenApiUtil.parseToMap(body),
  };
  var params = new OpenApi.Params{
    action = 'GetOutbounNumList',
    version = '2020-07-30',
    protocol = 'HTTPS',
    pathname = '/',
    method = 'POST',
    authType = 'AK',
    style = 'RPC',
    reqBodyType = 'formData',
    bodyType = 'json',
  };
  return callApi(params, req, runtime);
}

async function getOutbounNumList(request: GetOutbounNumListRequest): GetOutbounNumListResponse {
  var runtime = new Util.RuntimeOptions{};
  return getOutbounNumListWithOptions(request, runtime);
}

model GetOuterCallCenterDataListRequest {
  bizId?: string(name='BizId'),
  fromPhoneNum?: string(name='FromPhoneNum'),
  instanceId?: string(name='InstanceId'),
  queryEndTime?: string(name='QueryEndTime'),
  queryStartTime?: string(name='QueryStartTime'),
  sessionId?: string(name='SessionId'),
  toPhoneNum?: string(name='ToPhoneNum'),
}

model GetOuterCallCenterDataListResponseBody = {
  code?: string(name='Code'),
  data?: [ 
    {
      acid?: string(name='Acid'),
      bizId?: string(name='BizId'),
      bizType?: string(name='BizType'),
      callType?: string(name='CallType'),
      endReason?: string(name='EndReason'),
      extInfo?: string(name='ExtInfo'),
      fromPhoneNum?: string(name='FromPhoneNum'),
      interveneTime?: string(name='InterveneTime'),
      sessionId?: string(name='SessionId'),
      toPhoneNum?: string(name='ToPhoneNum'),
      userInfo?: string(name='UserInfo'),
    }
  ](name='Data'),
  httpStatusCode?: long(name='HttpStatusCode'),
  message?: string(name='Message'),
  requestId?: string(name='RequestId'),
  success?: boolean(name='Success'),
}

model GetOuterCallCenterDataListResponse = {
  headers: map[string]string(name='headers'),
  statusCode: int32(name='statusCode'),
  body: GetOuterCallCenterDataListResponseBody(name='body'),
}

async function getOuterCallCenterDataListWithOptions(request: GetOuterCallCenterDataListRequest, runtime: Util.RuntimeOptions): GetOuterCallCenterDataListResponse {
  Util.validateModel(request);
  var body : map[string]any = {};
  if (!Util.isUnset(request.bizId)) {
    body['BizId'] = request.bizId;
  }
  if (!Util.isUnset(request.fromPhoneNum)) {
    body['FromPhoneNum'] = request.fromPhoneNum;
  }
  if (!Util.isUnset(request.instanceId)) {
    body['InstanceId'] = request.instanceId;
  }
  if (!Util.isUnset(request.queryEndTime)) {
    body['QueryEndTime'] = request.queryEndTime;
  }
  if (!Util.isUnset(request.queryStartTime)) {
    body['QueryStartTime'] = request.queryStartTime;
  }
  if (!Util.isUnset(request.sessionId)) {
    body['SessionId'] = request.sessionId;
  }
  if (!Util.isUnset(request.toPhoneNum)) {
    body['ToPhoneNum'] = request.toPhoneNum;
  }
  var req = new OpenApi.OpenApiRequest{ 
    body = OpenApiUtil.parseToMap(body),
  };
  var params = new OpenApi.Params{
    action = 'GetOuterCallCenterDataList',
    version = '2020-07-30',
    protocol = 'HTTPS',
    pathname = '/',
    method = 'POST',
    authType = 'AK',
    style = 'RPC',
    reqBodyType = 'formData',
    bodyType = 'json',
  };
  return callApi(params, req, runtime);
}

async function getOuterCallCenterDataList(request: GetOuterCallCenterDataListRequest): GetOuterCallCenterDataListResponse {
  var runtime = new Util.RuntimeOptions{};
  return getOuterCallCenterDataListWithOptions(request, runtime);
}

model GetPostPolicyRequest {
  bizCode?: string(name='BizCode'),
  instanceId?: string(name='InstanceId'),
}

model GetPostPolicyResponseBody = {
  code?: string(name='Code'),
  data?: map[string]string(name='Data'),
  message?: string(name='Message'),
  requestId?: string(name='RequestId'),
  success?: boolean(name='Success'),
}

model GetPostPolicyResponse = {
  headers: map[string]string(name='headers'),
  statusCode: int32(name='statusCode'),
  body: GetPostPolicyResponseBody(name='body'),
}

async function getPostPolicyWithOptions(request: GetPostPolicyRequest, runtime: Util.RuntimeOptions): GetPostPolicyResponse {
  Util.validateModel(request);
  var body : map[string]any = {};
  if (!Util.isUnset(request.bizCode)) {
    body['BizCode'] = request.bizCode;
  }
  if (!Util.isUnset(request.instanceId)) {
    body['InstanceId'] = request.instanceId;
  }
  var req = new OpenApi.OpenApiRequest{ 
    body = OpenApiUtil.parseToMap(body),
  };
  var params = new OpenApi.Params{
    action = 'GetPostPolicy',
    version = '2020-07-30',
    protocol = 'HTTPS',
    pathname = '/',
    method = 'POST',
    authType = 'AK',
    style = 'RPC',
    reqBodyType = 'formData',
    bodyType = 'json',
  };
  return callApi(params, req, runtime);
}

async function getPostPolicy(request: GetPostPolicyRequest): GetPostPolicyResponse {
  var runtime = new Util.RuntimeOptions{};
  return getPostPolicyWithOptions(request, runtime);
}

model GetServicerSettingsRequest {
  clientToken?: string(name='ClientToken'),
  instanceId?: string(name='InstanceId'),
  propertyCode?: string(name='PropertyCode'),
  servicerId?: long(name='ServicerId'),
}

model GetServicerSettingsResponseBody = {
  code?: string(name='Code'),
  data?: string(name='Data'),
  httpStatusCode?: int32(name='HttpStatusCode'),
  message?: string(name='Message'),
  requestId?: string(name='RequestId'),
  success?: boolean(name='Success'),
}

model GetServicerSettingsResponse = {
  headers: map[string]string(name='headers'),
  statusCode: int32(name='statusCode'),
  body: GetServicerSettingsResponseBody(name='body'),
}

async function getServicerSettingsWithOptions(request: GetServicerSettingsRequest, runtime: Util.RuntimeOptions): GetServicerSettingsResponse {
  Util.validateModel(request);
  var query = OpenApiUtil.query(Util.toMap(request));
  var req = new OpenApi.OpenApiRequest{ 
    query = OpenApiUtil.query(query),
  };
  var params = new OpenApi.Params{
    action = 'GetServicerSettings',
    version = '2020-07-30',
    protocol = 'HTTPS',
    pathname = '/',
    method = 'GET',
    authType = 'AK',
    style = 'RPC',
    reqBodyType = 'formData',
    bodyType = 'json',
  };
  return callApi(params, req, runtime);
}

async function getServicerSettings(request: GetServicerSettingsRequest): GetServicerSettingsResponse {
  var runtime = new Util.RuntimeOptions{};
  return getServicerSettingsWithOptions(request, runtime);
}

model GetTagListRequest {
  entityId?: string(name='EntityId'),
  entityType?: string(name='EntityType'),
  instanceId?: string(name='InstanceId'),
}

model GetTagListResponseBody = {
  code?: string(name='Code'),
  data?: [ 
    {
      scenarioCode?: string(name='ScenarioCode'),
      tagGroupCode?: string(name='TagGroupCode'),
      tagGroupName?: string(name='TagGroupName'),
      tagValues?: [ 
        {
          description?: string(name='Description'),
          entityRelationNumber?: string(name='EntityRelationNumber'),
          status?: string(name='Status'),
          tagCode?: string(name='TagCode'),
          tagGroupCode?: string(name='TagGroupCode'),
          tagGroupName?: string(name='TagGroupName'),
          tagName?: string(name='TagName'),
        }
      ](name='TagValues'),
    }
  ](name='Data'),
  message?: string(name='Message'),
  requestId?: string(name='RequestId'),
  success?: boolean(name='Success'),
}

model GetTagListResponse = {
  headers: map[string]string(name='headers'),
  statusCode: int32(name='statusCode'),
  body: GetTagListResponseBody(name='body'),
}

async function getTagListWithOptions(request: GetTagListRequest, runtime: Util.RuntimeOptions): GetTagListResponse {
  Util.validateModel(request);
  var body : map[string]any = {};
  if (!Util.isUnset(request.entityId)) {
    body['EntityId'] = request.entityId;
  }
  if (!Util.isUnset(request.entityType)) {
    body['EntityType'] = request.entityType;
  }
  if (!Util.isUnset(request.instanceId)) {
    body['InstanceId'] = request.instanceId;
  }
  var req = new OpenApi.OpenApiRequest{ 
    body = OpenApiUtil.parseToMap(body),
  };
  var params = new OpenApi.Params{
    action = 'GetTagList',
    version = '2020-07-30',
    protocol = 'HTTPS',
    pathname = '/',
    method = 'POST',
    authType = 'AK',
    style = 'RPC',
    reqBodyType = 'formData',
    bodyType = 'json',
  };
  return callApi(params, req, runtime);
}

async function getTagList(request: GetTagListRequest): GetTagListResponse {
  var runtime = new Util.RuntimeOptions{};
  return getTagListWithOptions(request, runtime);
}

model GetTicketTemplateSchemaRequest {
  clientToken?: string(name='ClientToken'),
  instanceId?: string(name='InstanceId'),
  templateId?: long(name='TemplateId'),
}

model GetTicketTemplateSchemaResponseBody = {
  code?: string(name='Code'),
  data?: string(name='Data'),
  message?: string(name='Message'),
  requestId?: string(name='RequestId'),
  success?: boolean(name='Success'),
}

model GetTicketTemplateSchemaResponse = {
  headers: map[string]string(name='headers'),
  statusCode: int32(name='statusCode'),
  body: GetTicketTemplateSchemaResponseBody(name='body'),
}

async function getTicketTemplateSchemaWithOptions(request: GetTicketTemplateSchemaRequest, runtime: Util.RuntimeOptions): GetTicketTemplateSchemaResponse {
  Util.validateModel(request);
  var query = OpenApiUtil.query(Util.toMap(request));
  var req = new OpenApi.OpenApiRequest{ 
    query = OpenApiUtil.query(query),
  };
  var params = new OpenApi.Params{
    action = 'GetTicketTemplateSchema',
    version = '2020-07-30',
    protocol = 'HTTPS',
    pathname = '/',
    method = 'GET',
    authType = 'AK',
    style = 'RPC',
    reqBodyType = 'formData',
    bodyType = 'json',
  };
  return callApi(params, req, runtime);
}

async function getTicketTemplateSchema(request: GetTicketTemplateSchemaRequest): GetTicketTemplateSchemaResponse {
  var runtime = new Util.RuntimeOptions{};
  return getTicketTemplateSchemaWithOptions(request, runtime);
}

model GetUserByIdRequest {
  accessKeyId?: string(name='accessKeyId'),
  accessKeySecret?: string(name='accessKeySecret'),
  userId?: string(name='userId'),
}

model GetUserByIdResponseBody = {
  code?: string(name='Code'),
  data?: {
    email?: string(name='email'),
    extraInfo?: string(name='extraInfo'),
    foreignId?: string(name='foreignId'),
    id?: long(name='id'),
    nick?: string(name='nick'),
    sourceId?: long(name='sourceId'),
    telephone?: string(name='telephone'),
    type?: long(name='type'),
  }(name='Data'),
  message?: string(name='Message'),
  requestId?: string(name='RequestId'),
  success?: boolean(name='Success'),
}

model GetUserByIdResponse = {
  headers: map[string]string(name='headers'),
  statusCode: int32(name='statusCode'),
  body: GetUserByIdResponseBody(name='body'),
}

async function getUserByIdWithOptions(request: GetUserByIdRequest, runtime: Util.RuntimeOptions): GetUserByIdResponse {
  Util.validateModel(request);
  var query = {};
  if (!Util.isUnset(request.accessKeyId)) {
    query['accessKeyId'] = request.accessKeyId;
  }
  if (!Util.isUnset(request.accessKeySecret)) {
    query['accessKeySecret'] = request.accessKeySecret;
  }
  if (!Util.isUnset(request.userId)) {
    query['userId'] = request.userId;
  }
  var req = new OpenApi.OpenApiRequest{ 
    query = OpenApiUtil.query(query),
  };
  var params = new OpenApi.Params{
    action = 'GetUserById',
    version = '2020-07-30',
    protocol = 'HTTPS',
    pathname = '/',
    method = 'POST',
    authType = 'AK',
    style = 'RPC',
    reqBodyType = 'formData',
    bodyType = 'json',
  };
  return callApi(params, req, runtime);
}

async function getUserById(request: GetUserByIdRequest): GetUserByIdResponse {
  var runtime = new Util.RuntimeOptions{};
  return getUserByIdWithOptions(request, runtime);
}

model GetUserTokenRequest {
  appKey?: string(name='AppKey'),
  instanceId?: string(name='InstanceId'),
  nick?: string(name='Nick'),
  userId?: string(name='UserId'),
}

model GetUserTokenResponseBody = {
  code?: string(name='Code'),
  data?: {
    expires?: long(name='Expires'),
    token?: string(name='Token'),
  }(name='Data'),
  message?: string(name='Message'),
  requestId?: string(name='RequestId'),
  success?: boolean(name='Success'),
}

model GetUserTokenResponse = {
  headers: map[string]string(name='headers'),
  statusCode: int32(name='statusCode'),
  body: GetUserTokenResponseBody(name='body'),
}

async function getUserTokenWithOptions(request: GetUserTokenRequest, runtime: Util.RuntimeOptions): GetUserTokenResponse {
  Util.validateModel(request);
  var body : map[string]any = {};
  if (!Util.isUnset(request.appKey)) {
    body['AppKey'] = request.appKey;
  }
  if (!Util.isUnset(request.instanceId)) {
    body['InstanceId'] = request.instanceId;
  }
  if (!Util.isUnset(request.nick)) {
    body['Nick'] = request.nick;
  }
  if (!Util.isUnset(request.userId)) {
    body['UserId'] = request.userId;
  }
  var req = new OpenApi.OpenApiRequest{ 
    body = OpenApiUtil.parseToMap(body),
  };
  var params = new OpenApi.Params{
    action = 'GetUserToken',
    version = '2020-07-30',
    protocol = 'HTTPS',
    pathname = '/',
    method = 'POST',
    authType = 'AK',
    style = 'RPC',
    reqBodyType = 'formData',
    bodyType = 'json',
  };
  return callApi(params, req, runtime);
}

async function getUserToken(request: GetUserTokenRequest): GetUserTokenResponse {
  var runtime = new Util.RuntimeOptions{};
  return getUserTokenWithOptions(request, runtime);
}

model GrantRolesRequest {
  accountName?: string(name='AccountName'),
  clientToken?: string(name='ClientToken'),
  instanceId?: string(name='InstanceId'),
  operator?: string(name='Operator'),
  roleId?: [ long ](name='RoleId'),
}

model GrantRolesResponseBody = {
  code?: string(name='Code'),
  httpStatusCode?: long(name='HttpStatusCode'),
  message?: string(name='Message'),
  requestId?: string(name='RequestId'),
  success?: boolean(name='Success'),
}

model GrantRolesResponse = {
  headers: map[string]string(name='headers'),
  statusCode: int32(name='statusCode'),
  body: GrantRolesResponseBody(name='body'),
}

async function grantRolesWithOptions(request: GrantRolesRequest, runtime: Util.RuntimeOptions): GrantRolesResponse {
  Util.validateModel(request);
  var body : map[string]any = {};
  if (!Util.isUnset(request.accountName)) {
    body['AccountName'] = request.accountName;
  }
  if (!Util.isUnset(request.clientToken)) {
    body['ClientToken'] = request.clientToken;
  }
  if (!Util.isUnset(request.instanceId)) {
    body['InstanceId'] = request.instanceId;
  }
  if (!Util.isUnset(request.operator)) {
    body['Operator'] = request.operator;
  }
  if (!Util.isUnset(request.roleId)) {
    body['RoleId'] = request.roleId;
  }
  var req = new OpenApi.OpenApiRequest{ 
    body = OpenApiUtil.parseToMap(body),
  };
  var params = new OpenApi.Params{
    action = 'GrantRoles',
    version = '2020-07-30',
    protocol = 'HTTPS',
    pathname = '/',
    method = 'POST',
    authType = 'AK',
    style = 'RPC',
    reqBodyType = 'formData',
    bodyType = 'json',
  };
  return callApi(params, req, runtime);
}

async function grantRoles(request: GrantRolesRequest): GrantRolesResponse {
  var runtime = new Util.RuntimeOptions{};
  return grantRolesWithOptions(request, runtime);
}

model HangupCallRequest {
  accountName?: string(name='AccountName'),
  callId?: string(name='CallId'),
  clientToken?: string(name='ClientToken'),
  connectionId?: string(name='ConnectionId'),
  instanceId?: string(name='InstanceId'),
  jobId?: string(name='JobId'),
}

model HangupCallResponseBody = {
  code?: string(name='Code'),
  message?: string(name='Message'),
  requestId?: string(name='RequestId'),
  success?: boolean(name='Success'),
}

model HangupCallResponse = {
  headers: map[string]string(name='headers'),
  statusCode: int32(name='statusCode'),
  body: HangupCallResponseBody(name='body'),
}

async function hangupCallWithOptions(request: HangupCallRequest, runtime: Util.RuntimeOptions): HangupCallResponse {
  Util.validateModel(request);
  var body : map[string]any = {};
  if (!Util.isUnset(request.accountName)) {
    body['AccountName'] = request.accountName;
  }
  if (!Util.isUnset(request.callId)) {
    body['CallId'] = request.callId;
  }
  if (!Util.isUnset(request.clientToken)) {
    body['ClientToken'] = request.clientToken;
  }
  if (!Util.isUnset(request.connectionId)) {
    body['ConnectionId'] = request.connectionId;
  }
  if (!Util.isUnset(request.instanceId)) {
    body['InstanceId'] = request.instanceId;
  }
  if (!Util.isUnset(request.jobId)) {
    body['JobId'] = request.jobId;
  }
  var req = new OpenApi.OpenApiRequest{ 
    body = OpenApiUtil.parseToMap(body),
  };
  var params = new OpenApi.Params{
    action = 'HangupCall',
    version = '2020-07-30',
    protocol = 'HTTPS',
    pathname = '/',
    method = 'POST',
    authType = 'AK',
    style = 'RPC',
    reqBodyType = 'formData',
    bodyType = 'json',
  };
  return callApi(params, req, runtime);
}

async function hangupCall(request: HangupCallRequest): HangupCallResponse {
  var runtime = new Util.RuntimeOptions{};
  return hangupCallWithOptions(request, runtime);
}

model HangupThirdCallRequest {
  accountName?: string(name='AccountName'),
  callId?: string(name='CallId'),
  clientToken?: string(name='ClientToken'),
  connectionId?: string(name='ConnectionId'),
  instanceId?: string(name='InstanceId'),
  jobId?: string(name='JobId'),
}

model HangupThirdCallResponseBody = {
  code?: string(name='Code'),
  message?: string(name='Message'),
  requestId?: string(name='RequestId'),
  success?: boolean(name='Success'),
}

model HangupThirdCallResponse = {
  headers: map[string]string(name='headers'),
  statusCode: int32(name='statusCode'),
  body: HangupThirdCallResponseBody(name='body'),
}

async function hangupThirdCallWithOptions(request: HangupThirdCallRequest, runtime: Util.RuntimeOptions): HangupThirdCallResponse {
  Util.validateModel(request);
  var body : map[string]any = {};
  if (!Util.isUnset(request.accountName)) {
    body['AccountName'] = request.accountName;
  }
  if (!Util.isUnset(request.callId)) {
    body['CallId'] = request.callId;
  }
  if (!Util.isUnset(request.clientToken)) {
    body['ClientToken'] = request.clientToken;
  }
  if (!Util.isUnset(request.connectionId)) {
    body['ConnectionId'] = request.connectionId;
  }
  if (!Util.isUnset(request.instanceId)) {
    body['InstanceId'] = request.instanceId;
  }
  if (!Util.isUnset(request.jobId)) {
    body['JobId'] = request.jobId;
  }
  var req = new OpenApi.OpenApiRequest{ 
    body = OpenApiUtil.parseToMap(body),
  };
  var params = new OpenApi.Params{
    action = 'HangupThirdCall',
    version = '2020-07-30',
    protocol = 'HTTPS',
    pathname = '/',
    method = 'POST',
    authType = 'AK',
    style = 'RPC',
    reqBodyType = 'formData',
    bodyType = 'json',
  };
  return callApi(params, req, runtime);
}

async function hangupThirdCall(request: HangupThirdCallRequest): HangupThirdCallResponse {
  var runtime = new Util.RuntimeOptions{};
  return hangupThirdCallWithOptions(request, runtime);
}

model HoldCallRequest {
  accountName?: string(name='AccountName'),
  callId?: string(name='CallId'),
  clientToken?: string(name='ClientToken'),
  connectionId?: string(name='ConnectionId'),
  instanceId?: string(name='InstanceId'),
  jobId?: string(name='JobId'),
}

model HoldCallResponseBody = {
  code?: string(name='Code'),
  message?: string(name='Message'),
  requestId?: string(name='RequestId'),
  success?: boolean(name='Success'),
}

model HoldCallResponse = {
  headers: map[string]string(name='headers'),
  statusCode: int32(name='statusCode'),
  body: HoldCallResponseBody(name='body'),
}

async function holdCallWithOptions(request: HoldCallRequest, runtime: Util.RuntimeOptions): HoldCallResponse {
  Util.validateModel(request);
  var body : map[string]any = {};
  if (!Util.isUnset(request.accountName)) {
    body['AccountName'] = request.accountName;
  }
  if (!Util.isUnset(request.callId)) {
    body['CallId'] = request.callId;
  }
  if (!Util.isUnset(request.clientToken)) {
    body['ClientToken'] = request.clientToken;
  }
  if (!Util.isUnset(request.connectionId)) {
    body['ConnectionId'] = request.connectionId;
  }
  if (!Util.isUnset(request.instanceId)) {
    body['InstanceId'] = request.instanceId;
  }
  if (!Util.isUnset(request.jobId)) {
    body['JobId'] = request.jobId;
  }
  var req = new OpenApi.OpenApiRequest{ 
    body = OpenApiUtil.parseToMap(body),
  };
  var params = new OpenApi.Params{
    action = 'HoldCall',
    version = '2020-07-30',
    protocol = 'HTTPS',
    pathname = '/',
    method = 'POST',
    authType = 'AK',
    style = 'RPC',
    reqBodyType = 'formData',
    bodyType = 'json',
  };
  return callApi(params, req, runtime);
}

async function holdCall(request: HoldCallRequest): HoldCallResponse {
  var runtime = new Util.RuntimeOptions{};
  return holdCallWithOptions(request, runtime);
}

model IncrementSyncRequest {
  departmentInfos?: [ 
    {
      deptCode?: string(name='DeptCode'),
      deptHiding?: long(name='DeptHiding'),
      deptName?: string(name='DeptName'),
      deptOrder?: long(name='DeptOrder'),
      deptType?: string(name='DeptType'),
      ext?: string(name='Ext'),
      isDelete?: long(name='IsDelete'),
      parentCode?: string(name='ParentCode'),
    }
  ](name='DepartmentInfos'),
  eventType?: string(name='EventType'),
  ids?: [ string ](name='Ids'),
  instanceId?: string(name='InstanceId'),
  orgId?: string(name='OrgId'),
  roleInfos?: [ 
    {
      groupId?: string(name='GroupId'),
      isDelete?: long(name='IsDelete'),
      roleDesc?: string(name='RoleDesc'),
      roleId?: string(name='RoleId'),
      roleName?: string(name='RoleName'),
    }
  ](name='RoleInfos'),
  staffInfos?: [ 
    {
      depts?: [ 
        {
          id?: string(name='Id'),
          name?: string(name='Name'),
        }
      ](name='Depts'),
      email?: string(name='Email'),
      ext?: string(name='Ext'),
      isDelete?: long(name='IsDelete'),
      isDeptAdmin?: long(name='IsDeptAdmin'),
      mobile?: string(name='Mobile'),
      name?: string(name='Name'),
      nick?: string(name='Nick'),
      position?: string(name='Position'),
      remark?: string(name='Remark'),
      roles?: [ 
        {
          id?: string(name='Id'),
          name?: string(name='Name'),
        }
      ](name='Roles'),
      status?: long(name='Status'),
      tel?: string(name='Tel'),
      userId?: string(name='UserId'),
      workPlace?: string(name='WorkPlace'),
    }
  ](name='StaffInfos'),
}

model IncrementSyncResponseBody = {
  code?: string(name='Code'),
  data?: boolean(name='Data'),
  httpStatusCode?: long(name='HttpStatusCode'),
  message?: string(name='Message'),
  requestId?: string(name='RequestId'),
  success?: boolean(name='Success'),
}

model IncrementSyncResponse = {
  headers: map[string]string(name='headers'),
  statusCode: int32(name='statusCode'),
  body: IncrementSyncResponseBody(name='body'),
}

async function incrementSyncWithOptions(request: IncrementSyncRequest, runtime: Util.RuntimeOptions): IncrementSyncResponse {
  Util.validateModel(request);
  var body : map[string]any = {};
  var bodyFlat : map[string]any = {};
  if (!Util.isUnset(request.departmentInfos)) {
    bodyFlat['DepartmentInfos'] = request.departmentInfos;
  }
  if (!Util.isUnset(request.eventType)) {
    body['EventType'] = request.eventType;
  }
  if (!Util.isUnset(request.ids)) {
    bodyFlat['Ids'] = request.ids;
  }
  if (!Util.isUnset(request.instanceId)) {
    body['InstanceId'] = request.instanceId;
  }
  if (!Util.isUnset(request.orgId)) {
    body['OrgId'] = request.orgId;
  }
  if (!Util.isUnset(request.roleInfos)) {
    bodyFlat['RoleInfos'] = request.roleInfos;
  }
  if (!Util.isUnset(request.staffInfos)) {
    bodyFlat['StaffInfos'] = request.staffInfos;
  }
  body = {
    ...body,
    ...OpenApiUtil.query(bodyFlat),
  };

  var req = new OpenApi.OpenApiRequest{ 
    body = OpenApiUtil.parseToMap(body),
  };
  var params = new OpenApi.Params{
    action = 'IncrementSync',
    version = '2020-07-30',
    protocol = 'HTTPS',
    pathname = '/',
    method = 'POST',
    authType = 'AK',
    style = 'RPC',
    reqBodyType = 'formData',
    bodyType = 'json',
  };
  return callApi(params, req, runtime);
}

async function incrementSync(request: IncrementSyncRequest): IncrementSyncResponse {
  var runtime = new Util.RuntimeOptions{};
  return incrementSyncWithOptions(request, runtime);
}

model JoinThirdCallRequest {
  accountName?: string(name='AccountName'),
  callId?: string(name='CallId'),
  clientToken?: string(name='ClientToken'),
  connectionId?: string(name='ConnectionId'),
  holdConnectionId?: string(name='HoldConnectionId'),
  instanceId?: string(name='InstanceId'),
  jobId?: string(name='JobId'),
}

model JoinThirdCallResponseBody = {
  code?: string(name='Code'),
  message?: string(name='Message'),
  requestId?: string(name='RequestId'),
  success?: boolean(name='Success'),
}

model JoinThirdCallResponse = {
  headers: map[string]string(name='headers'),
  statusCode: int32(name='statusCode'),
  body: JoinThirdCallResponseBody(name='body'),
}

async function joinThirdCallWithOptions(request: JoinThirdCallRequest, runtime: Util.RuntimeOptions): JoinThirdCallResponse {
  Util.validateModel(request);
  var body : map[string]any = {};
  if (!Util.isUnset(request.accountName)) {
    body['AccountName'] = request.accountName;
  }
  if (!Util.isUnset(request.callId)) {
    body['CallId'] = request.callId;
  }
  if (!Util.isUnset(request.clientToken)) {
    body['ClientToken'] = request.clientToken;
  }
  if (!Util.isUnset(request.connectionId)) {
    body['ConnectionId'] = request.connectionId;
  }
  if (!Util.isUnset(request.holdConnectionId)) {
    body['HoldConnectionId'] = request.holdConnectionId;
  }
  if (!Util.isUnset(request.instanceId)) {
    body['InstanceId'] = request.instanceId;
  }
  if (!Util.isUnset(request.jobId)) {
    body['JobId'] = request.jobId;
  }
  var req = new OpenApi.OpenApiRequest{ 
    body = OpenApiUtil.parseToMap(body),
  };
  var params = new OpenApi.Params{
    action = 'JoinThirdCall',
    version = '2020-07-30',
    protocol = 'HTTPS',
    pathname = '/',
    method = 'POST',
    authType = 'AK',
    style = 'RPC',
    reqBodyType = 'formData',
    bodyType = 'json',
  };
  return callApi(params, req, runtime);
}

async function joinThirdCall(request: JoinThirdCallRequest): JoinThirdCallResponse {
  var runtime = new Util.RuntimeOptions{};
  return joinThirdCallWithOptions(request, runtime);
}

model ListAgentBySkillGroupIdRequest {
  clientToken?: string(name='ClientToken'),
  instanceId?: string(name='InstanceId'),
  skillGroupId?: long(name='SkillGroupId'),
}

model ListAgentBySkillGroupIdResponseBody = {
  code?: string(name='Code'),
  data?: [ 
    {
      account?: string(name='Account'),
      accountName?: string(name='AccountName'),
      agentId?: long(name='AgentId'),
      displayName?: string(name='DisplayName'),
      status?: int32(name='Status'),
      tenantId?: long(name='TenantId'),
    }
  ](name='Data'),
  message?: string(name='Message'),
  requestId?: string(name='RequestId'),
  success?: boolean(name='Success'),
}

model ListAgentBySkillGroupIdResponse = {
  headers: map[string]string(name='headers'),
  statusCode: int32(name='statusCode'),
  body: ListAgentBySkillGroupIdResponseBody(name='body'),
}

async function listAgentBySkillGroupIdWithOptions(request: ListAgentBySkillGroupIdRequest, runtime: Util.RuntimeOptions): ListAgentBySkillGroupIdResponse {
  Util.validateModel(request);
  var query = OpenApiUtil.query(Util.toMap(request));
  var req = new OpenApi.OpenApiRequest{ 
    query = OpenApiUtil.query(query),
  };
  var params = new OpenApi.Params{
    action = 'ListAgentBySkillGroupId',
    version = '2020-07-30',
    protocol = 'HTTPS',
    pathname = '/',
    method = 'GET',
    authType = 'AK',
    style = 'RPC',
    reqBodyType = 'formData',
    bodyType = 'json',
  };
  return callApi(params, req, runtime);
}

async function listAgentBySkillGroupId(request: ListAgentBySkillGroupIdRequest): ListAgentBySkillGroupIdResponse {
  var runtime = new Util.RuntimeOptions{};
  return listAgentBySkillGroupIdWithOptions(request, runtime);
}

model ListHotlineRecordRequest {
  callId?: string(name='CallId'),
  clientToken?: string(name='ClientToken'),
  instanceId?: string(name='InstanceId'),
}

model ListHotlineRecordResponseBody = {
  code?: string(name='Code'),
  data?: [ 
    {
      callId?: string(name='CallId'),
      connectionId?: string(name='ConnectionId'),
      endTime?: boolean(name='EndTime'),
      startTime?: boolean(name='StartTime'),
      url?: string(name='Url'),
    }
  ](name='Data'),
  httpStatusCode?: long(name='HttpStatusCode'),
  message?: string(name='Message'),
  requestId?: string(name='RequestId'),
  success?: boolean(name='Success'),
}

model ListHotlineRecordResponse = {
  headers: map[string]string(name='headers'),
  statusCode: int32(name='statusCode'),
  body: ListHotlineRecordResponseBody(name='body'),
}

async function listHotlineRecordWithOptions(request: ListHotlineRecordRequest, runtime: Util.RuntimeOptions): ListHotlineRecordResponse {
  Util.validateModel(request);
  var query = OpenApiUtil.query(Util.toMap(request));
  var req = new OpenApi.OpenApiRequest{ 
    query = OpenApiUtil.query(query),
  };
  var params = new OpenApi.Params{
    action = 'ListHotlineRecord',
    version = '2020-07-30',
    protocol = 'HTTPS',
    pathname = '/',
    method = 'GET',
    authType = 'AK',
    style = 'RPC',
    reqBodyType = 'formData',
    bodyType = 'json',
  };
  return callApi(params, req, runtime);
}

async function listHotlineRecord(request: ListHotlineRecordRequest): ListHotlineRecordResponse {
  var runtime = new Util.RuntimeOptions{};
  return listHotlineRecordWithOptions(request, runtime);
}

model ListOutboundPhoneNumberRequest {
  accountName?: string(name='AccountName'),
  clientToken?: string(name='ClientToken'),
  instanceId?: string(name='InstanceId'),
}

model ListOutboundPhoneNumberResponseBody = {
  code?: string(name='Code'),
  data?: [ string ](name='Data'),
  httpStatusCode?: long(name='HttpStatusCode'),
  message?: string(name='Message'),
  requestId?: string(name='RequestId'),
  success?: boolean(name='Success'),
}

model ListOutboundPhoneNumberResponse = {
  headers: map[string]string(name='headers'),
  statusCode: int32(name='statusCode'),
  body: ListOutboundPhoneNumberResponseBody(name='body'),
}

async function listOutboundPhoneNumberWithOptions(request: ListOutboundPhoneNumberRequest, runtime: Util.RuntimeOptions): ListOutboundPhoneNumberResponse {
  Util.validateModel(request);
  var query = OpenApiUtil.query(Util.toMap(request));
  var req = new OpenApi.OpenApiRequest{ 
    query = OpenApiUtil.query(query),
  };
  var params = new OpenApi.Params{
    action = 'ListOutboundPhoneNumber',
    version = '2020-07-30',
    protocol = 'HTTPS',
    pathname = '/',
    method = 'GET',
    authType = 'AK',
    style = 'RPC',
    reqBodyType = 'formData',
    bodyType = 'json',
  };
  return callApi(params, req, runtime);
}

async function listOutboundPhoneNumber(request: ListOutboundPhoneNumberRequest): ListOutboundPhoneNumberResponse {
  var runtime = new Util.RuntimeOptions{};
  return listOutboundPhoneNumberWithOptions(request, runtime);
}

model ListSkillGroupRequest {
  channelType?: int32(name='ChannelType'),
  clientToken?: string(name='ClientToken'),
  instanceId?: string(name='InstanceId'),
}

model ListSkillGroupResponseBody = {
  code?: string(name='Code'),
  data?: [ 
    {
      channelType?: int32(name='ChannelType'),
      description?: string(name='Description'),
      displayName?: string(name='DisplayName'),
      name?: string(name='Name'),
      skillGroupId?: long(name='SkillGroupId'),
    }
  ](name='Data'),
  message?: string(name='Message'),
  requestId?: string(name='RequestId'),
  success?: boolean(name='Success'),
}

model ListSkillGroupResponse = {
  headers: map[string]string(name='headers'),
  statusCode: int32(name='statusCode'),
  body: ListSkillGroupResponseBody(name='body'),
}

async function listSkillGroupWithOptions(request: ListSkillGroupRequest, runtime: Util.RuntimeOptions): ListSkillGroupResponse {
  Util.validateModel(request);
  var query = OpenApiUtil.query(Util.toMap(request));
  var req = new OpenApi.OpenApiRequest{ 
    query = OpenApiUtil.query(query),
  };
  var params = new OpenApi.Params{
    action = 'ListSkillGroup',
    version = '2020-07-30',
    protocol = 'HTTPS',
    pathname = '/',
    method = 'GET',
    authType = 'AK',
    style = 'RPC',
    reqBodyType = 'formData',
    bodyType = 'json',
  };
  return callApi(params, req, runtime);
}

async function listSkillGroup(request: ListSkillGroupRequest): ListSkillGroupResponse {
  var runtime = new Util.RuntimeOptions{};
  return listSkillGroupWithOptions(request, runtime);
}

model QueryHotlineSessionRequest {
  acid?: string(name='Acid'),
  callResult?: string(name='CallResult'),
  callType?: int32(name='CallType'),
  calledNumber?: string(name='CalledNumber'),
  callingNumber?: string(name='CallingNumber'),
  groupId?: long(name='GroupId'),
  groupName?: string(name='GroupName'),
  instanceId?: string(name='InstanceId'),
  memberId?: string(name='MemberId'),
  memberName?: string(name='MemberName'),
  pageNo?: int32(name='PageNo'),
  pageSize?: int32(name='PageSize'),
  params?: string(name='Params'),
  queryEndTime?: long(name='QueryEndTime'),
  queryStartTime?: long(name='QueryStartTime'),
  requestId?: string(name='RequestId'),
  servicerId?: string(name='ServicerId'),
  servicerName?: string(name='ServicerName'),
}

model QueryHotlineSessionResponseBody = {
  code?: string(name='Code'),
  data?: {
    callDetailRecord?: [ 
      {
        acid?: string(name='Acid'),
        callContinueTime?: int32(name='CallContinueTime'),
        callResult?: string(name='CallResult'),
        callType?: int32(name='CallType'),
        calledNumber?: string(name='CalledNumber'),
        callingNumber?: string(name='CallingNumber'),
        createTime?: string(name='CreateTime'),
        evaluationLevel?: int32(name='EvaluationLevel'),
        evaluationScore?: int32(name='EvaluationScore'),
        groupId?: long(name='GroupId'),
        groupName?: string(name='GroupName'),
        hangUpRole?: string(name='HangUpRole'),
        hangUpTime?: string(name='HangUpTime'),
        inQueueTime?: string(name='InQueueTime'),
        memberId?: string(name='MemberId'),
        memberName?: string(name='MemberName'),
        outQueueTime?: string(name='OutQueueTime'),
        pickUpTime?: string(name='PickUpTime'),
        queueUpContinueTime?: int32(name='QueueUpContinueTime'),
        ringContinueTime?: int32(name='RingContinueTime'),
        ringEndTime?: string(name='RingEndTime'),
        ringStartTime?: string(name='RingStartTime'),
        servicerId?: string(name='ServicerId'),
        servicerName?: string(name='ServicerName'),
      }
    ](name='CallDetailRecord'),
    pageNumber?: int32(name='PageNumber'),
    pageSize?: int32(name='PageSize'),
    totalCount?: int32(name='TotalCount'),
  }(name='Data'),
  message?: string(name='Message'),
  requestId?: string(name='RequestId'),
  success?: boolean(name='Success'),
}

model QueryHotlineSessionResponse = {
  headers: map[string]string(name='headers'),
  statusCode: int32(name='statusCode'),
  body: QueryHotlineSessionResponseBody(name='body'),
}

async function queryHotlineSessionWithOptions(request: QueryHotlineSessionRequest, runtime: Util.RuntimeOptions): QueryHotlineSessionResponse {
  Util.validateModel(request);
  var query = {};
  if (!Util.isUnset(request.acid)) {
    query['Acid'] = request.acid;
  }
  if (!Util.isUnset(request.callResult)) {
    query['CallResult'] = request.callResult;
  }
  if (!Util.isUnset(request.callType)) {
    query['CallType'] = request.callType;
  }
  if (!Util.isUnset(request.calledNumber)) {
    query['CalledNumber'] = request.calledNumber;
  }
  if (!Util.isUnset(request.callingNumber)) {
    query['CallingNumber'] = request.callingNumber;
  }
  if (!Util.isUnset(request.groupId)) {
    query['GroupId'] = request.groupId;
  }
  if (!Util.isUnset(request.groupName)) {
    query['GroupName'] = request.groupName;
  }
  if (!Util.isUnset(request.instanceId)) {
    query['InstanceId'] = request.instanceId;
  }
  if (!Util.isUnset(request.memberId)) {
    query['MemberId'] = request.memberId;
  }
  if (!Util.isUnset(request.memberName)) {
    query['MemberName'] = request.memberName;
  }
  if (!Util.isUnset(request.pageNo)) {
    query['PageNo'] = request.pageNo;
  }
  if (!Util.isUnset(request.pageSize)) {
    query['PageSize'] = request.pageSize;
  }
  if (!Util.isUnset(request.params)) {
    query['Params'] = request.params;
  }
  if (!Util.isUnset(request.queryEndTime)) {
    query['QueryEndTime'] = request.queryEndTime;
  }
  if (!Util.isUnset(request.queryStartTime)) {
    query['QueryStartTime'] = request.queryStartTime;
  }
  if (!Util.isUnset(request.requestId)) {
    query['RequestId'] = request.requestId;
  }
  if (!Util.isUnset(request.servicerId)) {
    query['ServicerId'] = request.servicerId;
  }
  if (!Util.isUnset(request.servicerName)) {
    query['ServicerName'] = request.servicerName;
  }
  var req = new OpenApi.OpenApiRequest{ 
    query = OpenApiUtil.query(query),
  };
  var params = new OpenApi.Params{
    action = 'QueryHotlineSession',
    version = '2020-07-30',
    protocol = 'HTTPS',
    pathname = '/',
    method = 'POST',
    authType = 'AK',
    style = 'RPC',
    reqBodyType = 'formData',
    bodyType = 'json',
  };
  return callApi(params, req, runtime);
}

async function queryHotlineSession(request: QueryHotlineSessionRequest): QueryHotlineSessionResponse {
  var runtime = new Util.RuntimeOptions{};
  return queryHotlineSessionWithOptions(request, runtime);
}

model QueryRingDetailListRequest {
  callOutStatus?: string(name='CallOutStatus'),
  endDate?: long(name='EndDate'),
  extra?: string(name='Extra'),
  fromPhoneNumList?: map[string]any(name='FromPhoneNumList'),
  instanceId?: string(name='InstanceId'),
  pageNo?: int32(name='PageNo'),
  pageSize?: int32(name='PageSize'),
  startDate?: long(name='StartDate'),
  toPhoneNumList?: map[string]any(name='ToPhoneNumList'),
}

model QueryRingDetailListShrinkRequest {
  callOutStatus?: string(name='CallOutStatus'),
  endDate?: long(name='EndDate'),
  extra?: string(name='Extra'),
  fromPhoneNumListShrink?: string(name='FromPhoneNumList'),
  instanceId?: string(name='InstanceId'),
  pageNo?: int32(name='PageNo'),
  pageSize?: int32(name='PageSize'),
  startDate?: long(name='StartDate'),
  toPhoneNumListShrink?: string(name='ToPhoneNumList'),
}

model QueryRingDetailListResponseBody = {
  code?: string(name='Code'),
  data?: string(name='Data'),
  httpStatusCode?: long(name='HttpStatusCode'),
  message?: string(name='Message'),
  requestId?: string(name='RequestId'),
  success?: boolean(name='Success'),
}

model QueryRingDetailListResponse = {
  headers: map[string]string(name='headers'),
  statusCode: int32(name='statusCode'),
  body: QueryRingDetailListResponseBody(name='body'),
}

async function queryRingDetailListWithOptions(tmpReq: QueryRingDetailListRequest, runtime: Util.RuntimeOptions): QueryRingDetailListResponse {
  Util.validateModel(tmpReq);
  var request = new QueryRingDetailListShrinkRequest{};
  OpenApiUtil.convert(tmpReq, request);
  if (!Util.isUnset(tmpReq.fromPhoneNumList)) {
    request.fromPhoneNumListShrink = OpenApiUtil.arrayToStringWithSpecifiedStyle(tmpReq.fromPhoneNumList, 'FromPhoneNumList', 'json');
  }
  if (!Util.isUnset(tmpReq.toPhoneNumList)) {
    request.toPhoneNumListShrink = OpenApiUtil.arrayToStringWithSpecifiedStyle(tmpReq.toPhoneNumList, 'ToPhoneNumList', 'json');
  }
  var body : map[string]any = {};
  if (!Util.isUnset(request.callOutStatus)) {
    body['CallOutStatus'] = request.callOutStatus;
  }
  if (!Util.isUnset(request.endDate)) {
    body['EndDate'] = request.endDate;
  }
  if (!Util.isUnset(request.extra)) {
    body['Extra'] = request.extra;
  }
  if (!Util.isUnset(request.fromPhoneNumListShrink)) {
    body['FromPhoneNumList'] = request.fromPhoneNumListShrink;
  }
  if (!Util.isUnset(request.instanceId)) {
    body['InstanceId'] = request.instanceId;
  }
  if (!Util.isUnset(request.pageNo)) {
    body['PageNo'] = request.pageNo;
  }
  if (!Util.isUnset(request.pageSize)) {
    body['PageSize'] = request.pageSize;
  }
  if (!Util.isUnset(request.startDate)) {
    body['StartDate'] = request.startDate;
  }
  if (!Util.isUnset(request.toPhoneNumListShrink)) {
    body['ToPhoneNumList'] = request.toPhoneNumListShrink;
  }
  var req = new OpenApi.OpenApiRequest{ 
    body = OpenApiUtil.parseToMap(body),
  };
  var params = new OpenApi.Params{
    action = 'QueryRingDetailList',
    version = '2020-07-30',
    protocol = 'HTTPS',
    pathname = '/',
    method = 'POST',
    authType = 'AK',
    style = 'RPC',
    reqBodyType = 'formData',
    bodyType = 'json',
  };
  return callApi(params, req, runtime);
}

async function queryRingDetailList(request: QueryRingDetailListRequest): QueryRingDetailListResponse {
  var runtime = new Util.RuntimeOptions{};
  return queryRingDetailListWithOptions(request, runtime);
}

model QueryServiceConfigRequest {
  instanceId?: string(name='InstanceId'),
  parameters?: string(name='Parameters'),
  viewCode?: string(name='ViewCode'),
}

model QueryServiceConfigResponseBody = {
  code?: string(name='Code'),
  data?: string(name='Data'),
  message?: string(name='Message'),
  requestId?: string(name='RequestId'),
  success?: boolean(name='Success'),
}

model QueryServiceConfigResponse = {
  headers: map[string]string(name='headers'),
  statusCode: int32(name='statusCode'),
  body: QueryServiceConfigResponseBody(name='body'),
}

async function queryServiceConfigWithOptions(request: QueryServiceConfigRequest, runtime: Util.RuntimeOptions): QueryServiceConfigResponse {
  Util.validateModel(request);
  var query = OpenApiUtil.query(Util.toMap(request));
  var req = new OpenApi.OpenApiRequest{ 
    query = OpenApiUtil.query(query),
  };
  var params = new OpenApi.Params{
    action = 'QueryServiceConfig',
    version = '2020-07-30',
    protocol = 'HTTPS',
    pathname = '/',
    method = 'GET',
    authType = 'AK',
    style = 'RPC',
    reqBodyType = 'formData',
    bodyType = 'json',
  };
  return callApi(params, req, runtime);
}

async function queryServiceConfig(request: QueryServiceConfigRequest): QueryServiceConfigResponse {
  var runtime = new Util.RuntimeOptions{};
  return queryServiceConfigWithOptions(request, runtime);
}

model QuerySkillGroupsRequest {
  clientToken?: string(name='ClientToken'),
  groupId?: long(name='GroupId'),
  groupName?: string(name='GroupName'),
  groupType?: int32(name='GroupType'),
  instanceId?: string(name='InstanceId'),
  pageNo?: int32(name='PageNo'),
  pageSize?: int32(name='PageSize'),
}

model QuerySkillGroupsResponseBody = {
  currentPage?: int32(name='CurrentPage'),
  data?: [ 
    {
      channelType?: int32(name='ChannelType'),
      description?: string(name='Description'),
      displayName?: string(name='DisplayName'),
      skillGroupId?: long(name='SkillGroupId'),
      skillGroupName?: string(name='SkillGroupName'),
    }
  ](name='Data'),
  onePageSize?: int32(name='OnePageSize'),
  requestId?: string(name='RequestId'),
  totalPage?: int32(name='TotalPage'),
  totalResults?: int32(name='TotalResults'),
}

model QuerySkillGroupsResponse = {
  headers: map[string]string(name='headers'),
  statusCode: int32(name='statusCode'),
  body: QuerySkillGroupsResponseBody(name='body'),
}

async function querySkillGroupsWithOptions(request: QuerySkillGroupsRequest, runtime: Util.RuntimeOptions): QuerySkillGroupsResponse {
  Util.validateModel(request);
  var query = {};
  if (!Util.isUnset(request.clientToken)) {
    query['ClientToken'] = request.clientToken;
  }
  if (!Util.isUnset(request.groupId)) {
    query['GroupId'] = request.groupId;
  }
  if (!Util.isUnset(request.groupName)) {
    query['GroupName'] = request.groupName;
  }
  if (!Util.isUnset(request.groupType)) {
    query['GroupType'] = request.groupType;
  }
  if (!Util.isUnset(request.instanceId)) {
    query['InstanceId'] = request.instanceId;
  }
  if (!Util.isUnset(request.pageNo)) {
    query['PageNo'] = request.pageNo;
  }
  if (!Util.isUnset(request.pageSize)) {
    query['PageSize'] = request.pageSize;
  }
  var req = new OpenApi.OpenApiRequest{ 
    query = OpenApiUtil.query(query),
  };
  var params = new OpenApi.Params{
    action = 'QuerySkillGroups',
    version = '2020-07-30',
    protocol = 'HTTPS',
    pathname = '/',
    method = 'POST',
    authType = 'AK',
    style = 'RPC',
    reqBodyType = 'formData',
    bodyType = 'json',
  };
  return callApi(params, req, runtime);
}

async function querySkillGroups(request: QuerySkillGroupsRequest): QuerySkillGroupsResponse {
  var runtime = new Util.RuntimeOptions{};
  return querySkillGroupsWithOptions(request, runtime);
}

model QueryTicketActionsRequest {
  actionCodeList?: [ long ](name='ActionCodeList'),
  instanceId?: string(name='InstanceId'),
  ticketId?: string(name='TicketId'),
}

model QueryTicketActionsResponseBody = {
  code?: string(name='Code'),
  data?: string(name='Data'),
  message?: string(name='Message'),
  requestId?: string(name='RequestId'),
  success?: boolean(name='Success'),
}

model QueryTicketActionsResponse = {
  headers: map[string]string(name='headers'),
  statusCode: int32(name='statusCode'),
  body: QueryTicketActionsResponseBody(name='body'),
}

async function queryTicketActionsWithOptions(request: QueryTicketActionsRequest, runtime: Util.RuntimeOptions): QueryTicketActionsResponse {
  Util.validateModel(request);
  var body : map[string]any = {};
  if (!Util.isUnset(request.actionCodeList)) {
    body['ActionCodeList'] = request.actionCodeList;
  }
  if (!Util.isUnset(request.instanceId)) {
    body['InstanceId'] = request.instanceId;
  }
  if (!Util.isUnset(request.ticketId)) {
    body['TicketId'] = request.ticketId;
  }
  var req = new OpenApi.OpenApiRequest{ 
    body = OpenApiUtil.parseToMap(body),
  };
  var params = new OpenApi.Params{
    action = 'QueryTicketActions',
    version = '2020-07-30',
    protocol = 'HTTPS',
    pathname = '/',
    method = 'POST',
    authType = 'AK',
    style = 'RPC',
    reqBodyType = 'formData',
    bodyType = 'json',
  };
  return callApi(params, req, runtime);
}

async function queryTicketActions(request: QueryTicketActionsRequest): QueryTicketActionsResponse {
  var runtime = new Util.RuntimeOptions{};
  return queryTicketActionsWithOptions(request, runtime);
}

model QueryTicketCountRequest {
  clientToken?: string(name='ClientToken'),
  instanceId?: string(name='InstanceId'),
  operatorId?: long(name='OperatorId'),
}

model QueryTicketCountResponseBody = {
  code?: string(name='Code'),
  data?: string(name='Data'),
  message?: string(name='Message'),
  requestId?: string(name='RequestId'),
  success?: boolean(name='Success'),
}

model QueryTicketCountResponse = {
  headers: map[string]string(name='headers'),
  statusCode: int32(name='statusCode'),
  body: QueryTicketCountResponseBody(name='body'),
}

async function queryTicketCountWithOptions(request: QueryTicketCountRequest, runtime: Util.RuntimeOptions): QueryTicketCountResponse {
  Util.validateModel(request);
  var query = {};
  if (!Util.isUnset(request.clientToken)) {
    query['ClientToken'] = request.clientToken;
  }
  if (!Util.isUnset(request.instanceId)) {
    query['InstanceId'] = request.instanceId;
  }
  if (!Util.isUnset(request.operatorId)) {
    query['OperatorId'] = request.operatorId;
  }
  var req = new OpenApi.OpenApiRequest{ 
    query = OpenApiUtil.query(query),
  };
  var params = new OpenApi.Params{
    action = 'QueryTicketCount',
    version = '2020-07-30',
    protocol = 'HTTPS',
    pathname = '/',
    method = 'POST',
    authType = 'AK',
    style = 'RPC',
    reqBodyType = 'formData',
    bodyType = 'json',
  };
  return callApi(params, req, runtime);
}

async function queryTicketCount(request: QueryTicketCountRequest): QueryTicketCountResponse {
  var runtime = new Util.RuntimeOptions{};
  return queryTicketCountWithOptions(request, runtime);
}

model QueryTicketsRequest {
  accountName?: string(name='AccountName'),
  caseId?: long(name='CaseId'),
  caseStatus?: int32(name='CaseStatus'),
  caseType?: int32(name='CaseType'),
  channelId?: string(name='ChannelId'),
  channelType?: int32(name='ChannelType'),
  currentPage?: int32(name='CurrentPage'),
  dealId?: long(name='DealId'),
  extra?: map[string]any(name='Extra'),
  instanceId?: string(name='InstanceId'),
  pageSize?: int32(name='PageSize'),
  srType?: long(name='SrType'),
  taskStatus?: int32(name='TaskStatus'),
  touchId?: long(name='TouchId'),
}

model QueryTicketsShrinkRequest {
  accountName?: string(name='AccountName'),
  caseId?: long(name='CaseId'),
  caseStatus?: int32(name='CaseStatus'),
  caseType?: int32(name='CaseType'),
  channelId?: string(name='ChannelId'),
  channelType?: int32(name='ChannelType'),
  currentPage?: int32(name='CurrentPage'),
  dealId?: long(name='DealId'),
  extraShrink?: string(name='Extra'),
  instanceId?: string(name='InstanceId'),
  pageSize?: int32(name='PageSize'),
  srType?: long(name='SrType'),
  taskStatus?: int32(name='TaskStatus'),
  touchId?: long(name='TouchId'),
}

model QueryTicketsResponseBody = {
  code?: string(name='Code'),
  data?: string(name='Data'),
  message?: string(name='Message'),
  requestId?: string(name='RequestId'),
  success?: boolean(name='Success'),
}

model QueryTicketsResponse = {
  headers: map[string]string(name='headers'),
  statusCode: int32(name='statusCode'),
  body: QueryTicketsResponseBody(name='body'),
}

async function queryTicketsWithOptions(tmpReq: QueryTicketsRequest, runtime: Util.RuntimeOptions): QueryTicketsResponse {
  Util.validateModel(tmpReq);
  var request = new QueryTicketsShrinkRequest{};
  OpenApiUtil.convert(tmpReq, request);
  if (!Util.isUnset(tmpReq.extra)) {
    request.extraShrink = OpenApiUtil.arrayToStringWithSpecifiedStyle(tmpReq.extra, 'Extra', 'json');
  }
  var body : map[string]any = {};
  if (!Util.isUnset(request.accountName)) {
    body['AccountName'] = request.accountName;
  }
  if (!Util.isUnset(request.caseId)) {
    body['CaseId'] = request.caseId;
  }
  if (!Util.isUnset(request.caseStatus)) {
    body['CaseStatus'] = request.caseStatus;
  }
  if (!Util.isUnset(request.caseType)) {
    body['CaseType'] = request.caseType;
  }
  if (!Util.isUnset(request.channelId)) {
    body['ChannelId'] = request.channelId;
  }
  if (!Util.isUnset(request.channelType)) {
    body['ChannelType'] = request.channelType;
  }
  if (!Util.isUnset(request.currentPage)) {
    body['CurrentPage'] = request.currentPage;
  }
  if (!Util.isUnset(request.dealId)) {
    body['DealId'] = request.dealId;
  }
  if (!Util.isUnset(request.extraShrink)) {
    body['Extra'] = request.extraShrink;
  }
  if (!Util.isUnset(request.instanceId)) {
    body['InstanceId'] = request.instanceId;
  }
  if (!Util.isUnset(request.pageSize)) {
    body['PageSize'] = request.pageSize;
  }
  if (!Util.isUnset(request.srType)) {
    body['SrType'] = request.srType;
  }
  if (!Util.isUnset(request.taskStatus)) {
    body['TaskStatus'] = request.taskStatus;
  }
  if (!Util.isUnset(request.touchId)) {
    body['TouchId'] = request.touchId;
  }
  var req = new OpenApi.OpenApiRequest{ 
    body = OpenApiUtil.parseToMap(body),
  };
  var params = new OpenApi.Params{
    action = 'QueryTickets',
    version = '2020-07-30',
    protocol = 'HTTPS',
    pathname = '/',
    method = 'POST',
    authType = 'AK',
    style = 'RPC',
    reqBodyType = 'formData',
    bodyType = 'json',
  };
  return callApi(params, req, runtime);
}

async function queryTickets(request: QueryTicketsRequest): QueryTicketsResponse {
  var runtime = new Util.RuntimeOptions{};
  return queryTicketsWithOptions(request, runtime);
}

model RemoveSkillGroupRequest {
  clientToken?: string(name='ClientToken'),
  instanceId?: string(name='InstanceId'),
  skillGroupId?: string(name='SkillGroupId'),
}

model RemoveSkillGroupResponseBody = {
  code?: string(name='Code'),
  message?: string(name='Message'),
  requestId?: string(name='RequestId'),
  success?: boolean(name='Success'),
}

model RemoveSkillGroupResponse = {
  headers: map[string]string(name='headers'),
  statusCode: int32(name='statusCode'),
  body: RemoveSkillGroupResponseBody(name='body'),
}

async function removeSkillGroupWithOptions(request: RemoveSkillGroupRequest, runtime: Util.RuntimeOptions): RemoveSkillGroupResponse {
  Util.validateModel(request);
  var body : map[string]any = {};
  if (!Util.isUnset(request.clientToken)) {
    body['ClientToken'] = request.clientToken;
  }
  if (!Util.isUnset(request.instanceId)) {
    body['InstanceId'] = request.instanceId;
  }
  if (!Util.isUnset(request.skillGroupId)) {
    body['SkillGroupId'] = request.skillGroupId;
  }
  var req = new OpenApi.OpenApiRequest{ 
    body = OpenApiUtil.parseToMap(body),
  };
  var params = new OpenApi.Params{
    action = 'RemoveSkillGroup',
    version = '2020-07-30',
    protocol = 'HTTPS',
    pathname = '/',
    method = 'POST',
    authType = 'AK',
    style = 'RPC',
    reqBodyType = 'formData',
    bodyType = 'json',
  };
  return callApi(params, req, runtime);
}

async function removeSkillGroup(request: RemoveSkillGroupRequest): RemoveSkillGroupResponse {
  var runtime = new Util.RuntimeOptions{};
  return removeSkillGroupWithOptions(request, runtime);
}

model SearchTicketByIdRequest {
  clientToken?: string(name='ClientToken'),
  instanceId?: string(name='InstanceId'),
  statusCode?: int32(name='StatusCode'),
  ticketId?: long(name='TicketId'),
}

model SearchTicketByIdResponseBody = {
  code?: string(name='Code'),
  data?: {
    activities?: [ 
      {
        activityCode?: string(name='ActivityCode'),
        activityFormData?: string(name='ActivityFormData'),
      }
    ](name='Activities'),
    activityRecords?: [ 
      {
        actionCode?: string(name='ActionCode'),
        actionCodeDesc?: string(name='ActionCodeDesc'),
        gmtCreate?: long(name='GmtCreate'),
        memo?: string(name='Memo'),
        operatorName?: string(name='OperatorName'),
      }
    ](name='ActivityRecords'),
    carbonCopy?: string(name='CarbonCopy'),
    caseStatus?: int32(name='CaseStatus'),
    categoryId?: long(name='CategoryId'),
    createTime?: long(name='CreateTime'),
    creatorId?: long(name='CreatorId'),
    creatorName?: string(name='CreatorName'),
    creatorType?: int32(name='CreatorType'),
    formData?: string(name='FormData'),
    fromInfo?: string(name='FromInfo'),
    memberId?: long(name='MemberId'),
    memberName?: string(name='MemberName'),
    modifiedTime?: long(name='ModifiedTime'),
    priority?: int32(name='Priority'),
    serviceId?: long(name='ServiceId'),
    templateId?: long(name='TemplateId'),
    ticketId?: long(name='TicketId'),
    ticketName?: string(name='TicketName'),
  }(name='Data'),
  httpStatusCode?: long(name='HttpStatusCode'),
  message?: string(name='Message'),
  requestId?: string(name='RequestId'),
  success?: boolean(name='Success'),
}

model SearchTicketByIdResponse = {
  headers: map[string]string(name='headers'),
  statusCode: int32(name='statusCode'),
  body: SearchTicketByIdResponseBody(name='body'),
}

async function searchTicketByIdWithOptions(request: SearchTicketByIdRequest, runtime: Util.RuntimeOptions): SearchTicketByIdResponse {
  Util.validateModel(request);
  var query = OpenApiUtil.query(Util.toMap(request));
  var req = new OpenApi.OpenApiRequest{ 
    query = OpenApiUtil.query(query),
  };
  var params = new OpenApi.Params{
    action = 'SearchTicketById',
    version = '2020-07-30',
    protocol = 'HTTPS',
    pathname = '/',
    method = 'GET',
    authType = 'AK',
    style = 'RPC',
    reqBodyType = 'formData',
    bodyType = 'json',
  };
  return callApi(params, req, runtime);
}

async function searchTicketById(request: SearchTicketByIdRequest): SearchTicketByIdResponse {
  var runtime = new Util.RuntimeOptions{};
  return searchTicketByIdWithOptions(request, runtime);
}

model SearchTicketByPhoneRequest {
  clientToken?: string(name='ClientToken'),
  endTime?: long(name='EndTime'),
  instanceId?: string(name='InstanceId'),
  pageNo?: int32(name='PageNo'),
  pageSize?: int32(name='PageSize'),
  phone?: string(name='Phone'),
  startTime?: long(name='StartTime'),
  templateId?: long(name='TemplateId'),
  ticketStatus?: string(name='TicketStatus'),
}

model SearchTicketByPhoneResponseBody = {
  code?: string(name='Code'),
  data?: [ 
    {
      carbonCopy?: string(name='CarbonCopy'),
      caseStatus?: int32(name='CaseStatus'),
      categoryId?: long(name='CategoryId'),
      createTime?: long(name='CreateTime'),
      creatorId?: long(name='CreatorId'),
      creatorName?: string(name='CreatorName'),
      creatorType?: int32(name='CreatorType'),
      formData?: string(name='FormData'),
      fromInfo?: string(name='FromInfo'),
      memberId?: long(name='MemberId'),
      memberName?: string(name='MemberName'),
      modifiedTime?: long(name='ModifiedTime'),
      priority?: int32(name='Priority'),
      serviceId?: long(name='ServiceId'),
      taskStatus?: string(name='TaskStatus'),
      templateId?: long(name='TemplateId'),
      ticketId?: long(name='TicketId'),
    }
  ](name='Data'),
  message?: string(name='Message'),
  onePageSize?: int32(name='OnePageSize'),
  pageNo?: int32(name='PageNo'),
  requestId?: string(name='RequestId'),
  success?: boolean(name='Success'),
  totalPage?: int32(name='TotalPage'),
  totalResults?: int32(name='TotalResults'),
}

model SearchTicketByPhoneResponse = {
  headers: map[string]string(name='headers'),
  statusCode: int32(name='statusCode'),
  body: SearchTicketByPhoneResponseBody(name='body'),
}

async function searchTicketByPhoneWithOptions(request: SearchTicketByPhoneRequest, runtime: Util.RuntimeOptions): SearchTicketByPhoneResponse {
  Util.validateModel(request);
  var query = OpenApiUtil.query(Util.toMap(request));
  var req = new OpenApi.OpenApiRequest{ 
    query = OpenApiUtil.query(query),
  };
  var params = new OpenApi.Params{
    action = 'SearchTicketByPhone',
    version = '2020-07-30',
    protocol = 'HTTPS',
    pathname = '/',
    method = 'GET',
    authType = 'AK',
    style = 'RPC',
    reqBodyType = 'formData',
    bodyType = 'json',
  };
  return callApi(params, req, runtime);
}

async function searchTicketByPhone(request: SearchTicketByPhoneRequest): SearchTicketByPhoneResponse {
  var runtime = new Util.RuntimeOptions{};
  return searchTicketByPhoneWithOptions(request, runtime);
}

model SearchTicketListRequest {
  clientToken?: string(name='ClientToken'),
  endTime?: long(name='EndTime'),
  instanceId?: string(name='InstanceId'),
  operatorId?: long(name='OperatorId'),
  pageNo?: int32(name='PageNo'),
  pageSize?: int32(name='PageSize'),
  startTime?: long(name='StartTime'),
  ticketStatus?: string(name='TicketStatus'),
}

model SearchTicketListResponseBody = {
  code?: string(name='Code'),
  data?: [ 
    {
      carbonCopy?: string(name='CarbonCopy'),
      caseStatus?: int32(name='CaseStatus'),
      categoryId?: long(name='CategoryId'),
      createTime?: long(name='CreateTime'),
      creatorId?: long(name='CreatorId'),
      creatorName?: string(name='CreatorName'),
      creatorType?: int32(name='CreatorType'),
      formData?: string(name='FormData'),
      fromInfo?: string(name='FromInfo'),
      memberId?: long(name='MemberId'),
      memberName?: string(name='MemberName'),
      modifiedTime?: long(name='ModifiedTime'),
      priority?: int32(name='Priority'),
      serviceId?: long(name='ServiceId'),
      taskStatus?: string(name='TaskStatus'),
      templateId?: long(name='TemplateId'),
      ticketId?: long(name='TicketId'),
    }
  ](name='Data'),
  message?: string(name='Message'),
  onePageSize?: int32(name='OnePageSize'),
  pageNo?: int32(name='PageNo'),
  requestId?: string(name='RequestId'),
  success?: boolean(name='Success'),
  totalPage?: int32(name='TotalPage'),
  totalResults?: int32(name='TotalResults'),
}

model SearchTicketListResponse = {
  headers: map[string]string(name='headers'),
  statusCode: int32(name='statusCode'),
  body: SearchTicketListResponseBody(name='body'),
}

async function searchTicketListWithOptions(request: SearchTicketListRequest, runtime: Util.RuntimeOptions): SearchTicketListResponse {
  Util.validateModel(request);
  var query = OpenApiUtil.query(Util.toMap(request));
  var req = new OpenApi.OpenApiRequest{ 
    query = OpenApiUtil.query(query),
  };
  var params = new OpenApi.Params{
    action = 'SearchTicketList',
    version = '2020-07-30',
    protocol = 'HTTPS',
    pathname = '/',
    method = 'GET',
    authType = 'AK',
    style = 'RPC',
    reqBodyType = 'formData',
    bodyType = 'json',
  };
  return callApi(params, req, runtime);
}

async function searchTicketList(request: SearchTicketListRequest): SearchTicketListResponse {
  var runtime = new Util.RuntimeOptions{};
  return searchTicketListWithOptions(request, runtime);
}

model SendHotlineHeartBeatRequest {
  accountName?: string(name='AccountName'),
  clientToken?: string(name='ClientToken'),
  instanceId?: string(name='InstanceId'),
  token?: string(name='Token'),
}

model SendHotlineHeartBeatResponseBody = {
  code?: string(name='Code'),
  message?: string(name='Message'),
  requestId?: string(name='RequestId'),
  success?: boolean(name='Success'),
}

model SendHotlineHeartBeatResponse = {
  headers: map[string]string(name='headers'),
  statusCode: int32(name='statusCode'),
  body: SendHotlineHeartBeatResponseBody(name='body'),
}

async function sendHotlineHeartBeatWithOptions(request: SendHotlineHeartBeatRequest, runtime: Util.RuntimeOptions): SendHotlineHeartBeatResponse {
  Util.validateModel(request);
  var body : map[string]any = {};
  if (!Util.isUnset(request.accountName)) {
    body['AccountName'] = request.accountName;
  }
  if (!Util.isUnset(request.clientToken)) {
    body['ClientToken'] = request.clientToken;
  }
  if (!Util.isUnset(request.instanceId)) {
    body['InstanceId'] = request.instanceId;
  }
  if (!Util.isUnset(request.token)) {
    body['Token'] = request.token;
  }
  var req = new OpenApi.OpenApiRequest{ 
    body = OpenApiUtil.parseToMap(body),
  };
  var params = new OpenApi.Params{
    action = 'SendHotlineHeartBeat',
    version = '2020-07-30',
    protocol = 'HTTPS',
    pathname = '/',
    method = 'POST',
    authType = 'AK',
    style = 'RPC',
    reqBodyType = 'formData',
    bodyType = 'json',
  };
  return callApi(params, req, runtime);
}

async function sendHotlineHeartBeat(request: SendHotlineHeartBeatRequest): SendHotlineHeartBeatResponse {
  var runtime = new Util.RuntimeOptions{};
  return sendHotlineHeartBeatWithOptions(request, runtime);
}

model SendOutboundCommandRequest {
  accountName?: string(name='AccountName'),
  calledNumber?: string(name='CalledNumber'),
  callingNumber?: string(name='CallingNumber'),
  customerInfo?: string(name='CustomerInfo'),
  instanceId?: string(name='InstanceId'),
}

model SendOutboundCommandResponseBody = {
  code?: string(name='Code'),
  data?: string(name='Data'),
  message?: string(name='Message'),
  requestId?: string(name='RequestId'),
  success?: boolean(name='Success'),
}

model SendOutboundCommandResponse = {
  headers: map[string]string(name='headers'),
  statusCode: int32(name='statusCode'),
  body: SendOutboundCommandResponseBody(name='body'),
}

async function sendOutboundCommandWithOptions(request: SendOutboundCommandRequest, runtime: Util.RuntimeOptions): SendOutboundCommandResponse {
  Util.validateModel(request);
  var body : map[string]any = {};
  if (!Util.isUnset(request.accountName)) {
    body['AccountName'] = request.accountName;
  }
  if (!Util.isUnset(request.calledNumber)) {
    body['CalledNumber'] = request.calledNumber;
  }
  if (!Util.isUnset(request.callingNumber)) {
    body['CallingNumber'] = request.callingNumber;
  }
  if (!Util.isUnset(request.customerInfo)) {
    body['CustomerInfo'] = request.customerInfo;
  }
  if (!Util.isUnset(request.instanceId)) {
    body['InstanceId'] = request.instanceId;
  }
  var req = new OpenApi.OpenApiRequest{ 
    body = OpenApiUtil.parseToMap(body),
  };
  var params = new OpenApi.Params{
    action = 'SendOutboundCommand',
    version = '2020-07-30',
    protocol = 'HTTPS',
    pathname = '/',
    method = 'POST',
    authType = 'AK',
    style = 'RPC',
    reqBodyType = 'formData',
    bodyType = 'json',
  };
  return callApi(params, req, runtime);
}

async function sendOutboundCommand(request: SendOutboundCommandRequest): SendOutboundCommandResponse {
  var runtime = new Util.RuntimeOptions{};
  return sendOutboundCommandWithOptions(request, runtime);
}

model SendXspaceStationMsgToServicerRequest {
  content?: string(name='Content'),
  instanceId?: string(name='InstanceId'),
  needReceiptConfirm?: boolean(name='NeedReceiptConfirm'),
  needRingNotify?: boolean(name='NeedRingNotify'),
  receiverIds?: [ long ](name='ReceiverIds'),
  scene?: string(name='Scene'),
  senderId?: long(name='SenderId'),
  sourceId?: long(name='SourceId'),
  title?: string(name='Title'),
}

model SendXspaceStationMsgToServicerShrinkRequest {
  content?: string(name='Content'),
  instanceId?: string(name='InstanceId'),
  needReceiptConfirm?: boolean(name='NeedReceiptConfirm'),
  needRingNotify?: boolean(name='NeedRingNotify'),
  receiverIdsShrink?: string(name='ReceiverIds'),
  scene?: string(name='Scene'),
  senderId?: long(name='SenderId'),
  sourceId?: long(name='SourceId'),
  title?: string(name='Title'),
}

model SendXspaceStationMsgToServicerResponseBody = {
  code?: string(name='Code'),
  data?: string(name='Data'),
  httpStatusCode?: long(name='HttpStatusCode'),
  message?: string(name='Message'),
  requestId?: string(name='RequestId'),
  success?: boolean(name='Success'),
}

model SendXspaceStationMsgToServicerResponse = {
  headers: map[string]string(name='headers'),
  statusCode: int32(name='statusCode'),
  body: SendXspaceStationMsgToServicerResponseBody(name='body'),
}

async function sendXspaceStationMsgToServicerWithOptions(tmpReq: SendXspaceStationMsgToServicerRequest, runtime: Util.RuntimeOptions): SendXspaceStationMsgToServicerResponse {
  Util.validateModel(tmpReq);
  var request = new SendXspaceStationMsgToServicerShrinkRequest{};
  OpenApiUtil.convert(tmpReq, request);
  if (!Util.isUnset(tmpReq.receiverIds)) {
    request.receiverIdsShrink = OpenApiUtil.arrayToStringWithSpecifiedStyle(tmpReq.receiverIds, 'ReceiverIds', 'simple');
  }
  var query = {};
  if (!Util.isUnset(request.content)) {
    query['Content'] = request.content;
  }
  if (!Util.isUnset(request.instanceId)) {
    query['InstanceId'] = request.instanceId;
  }
  if (!Util.isUnset(request.needReceiptConfirm)) {
    query['NeedReceiptConfirm'] = request.needReceiptConfirm;
  }
  if (!Util.isUnset(request.needRingNotify)) {
    query['NeedRingNotify'] = request.needRingNotify;
  }
  if (!Util.isUnset(request.receiverIdsShrink)) {
    query['ReceiverIds'] = request.receiverIdsShrink;
  }
  if (!Util.isUnset(request.scene)) {
    query['Scene'] = request.scene;
  }
  if (!Util.isUnset(request.senderId)) {
    query['SenderId'] = request.senderId;
  }
  if (!Util.isUnset(request.sourceId)) {
    query['SourceId'] = request.sourceId;
  }
  if (!Util.isUnset(request.title)) {
    query['Title'] = request.title;
  }
  var req = new OpenApi.OpenApiRequest{ 
    query = OpenApiUtil.query(query),
  };
  var params = new OpenApi.Params{
    action = 'SendXspaceStationMsgToServicer',
    version = '2020-07-30',
    protocol = 'HTTPS',
    pathname = '/',
    method = 'POST',
    authType = 'AK',
    style = 'RPC',
    reqBodyType = 'formData',
    bodyType = 'json',
  };
  return callApi(params, req, runtime);
}

async function sendXspaceStationMsgToServicer(request: SendXspaceStationMsgToServicerRequest): SendXspaceStationMsgToServicerResponse {
  var runtime = new Util.RuntimeOptions{};
  return sendXspaceStationMsgToServicerWithOptions(request, runtime);
}

model StartCallRequest {
  accountName?: string(name='AccountName'),
  callee?: string(name='Callee'),
  caller?: string(name='Caller'),
  clientToken?: string(name='ClientToken'),
  instanceId?: string(name='InstanceId'),
}

model StartCallResponseBody = {
  code?: string(name='Code'),
  message?: string(name='Message'),
  requestId?: string(name='RequestId'),
  success?: boolean(name='Success'),
}

model StartCallResponse = {
  headers: map[string]string(name='headers'),
  statusCode: int32(name='statusCode'),
  body: StartCallResponseBody(name='body'),
}

async function startCallWithOptions(request: StartCallRequest, runtime: Util.RuntimeOptions): StartCallResponse {
  Util.validateModel(request);
  var body : map[string]any = {};
  if (!Util.isUnset(request.accountName)) {
    body['AccountName'] = request.accountName;
  }
  if (!Util.isUnset(request.callee)) {
    body['Callee'] = request.callee;
  }
  if (!Util.isUnset(request.caller)) {
    body['Caller'] = request.caller;
  }
  if (!Util.isUnset(request.clientToken)) {
    body['ClientToken'] = request.clientToken;
  }
  if (!Util.isUnset(request.instanceId)) {
    body['InstanceId'] = request.instanceId;
  }
  var req = new OpenApi.OpenApiRequest{ 
    body = OpenApiUtil.parseToMap(body),
  };
  var params = new OpenApi.Params{
    action = 'StartCall',
    version = '2020-07-30',
    protocol = 'HTTPS',
    pathname = '/',
    method = 'POST',
    authType = 'AK',
    style = 'RPC',
    reqBodyType = 'formData',
    bodyType = 'json',
  };
  return callApi(params, req, runtime);
}

async function startCall(request: StartCallRequest): StartCallResponse {
  var runtime = new Util.RuntimeOptions{};
  return startCallWithOptions(request, runtime);
}

model StartCallV2Request {
  accountName?: string(name='AccountName'),
  callee?: string(name='Callee'),
  caller?: string(name='Caller'),
  clientToken?: string(name='ClientToken'),
  instanceId?: string(name='InstanceId'),
  jsonMsg?: string(name='JsonMsg'),
}

model StartCallV2ResponseBody = {
  code?: string(name='Code'),
  message?: string(name='Message'),
  requestId?: string(name='RequestId'),
  success?: boolean(name='Success'),
}

model StartCallV2Response = {
  headers: map[string]string(name='headers'),
  statusCode: int32(name='statusCode'),
  body: StartCallV2ResponseBody(name='body'),
}

async function startCallV2WithOptions(request: StartCallV2Request, runtime: Util.RuntimeOptions): StartCallV2Response {
  Util.validateModel(request);
  var body : map[string]any = {};
  if (!Util.isUnset(request.accountName)) {
    body['AccountName'] = request.accountName;
  }
  if (!Util.isUnset(request.callee)) {
    body['Callee'] = request.callee;
  }
  if (!Util.isUnset(request.caller)) {
    body['Caller'] = request.caller;
  }
  if (!Util.isUnset(request.clientToken)) {
    body['ClientToken'] = request.clientToken;
  }
  if (!Util.isUnset(request.instanceId)) {
    body['InstanceId'] = request.instanceId;
  }
  if (!Util.isUnset(request.jsonMsg)) {
    body['JsonMsg'] = request.jsonMsg;
  }
  var req = new OpenApi.OpenApiRequest{ 
    body = OpenApiUtil.parseToMap(body),
  };
  var params = new OpenApi.Params{
    action = 'StartCallV2',
    version = '2020-07-30',
    protocol = 'HTTPS',
    pathname = '/',
    method = 'POST',
    authType = 'AK',
    style = 'RPC',
    reqBodyType = 'formData',
    bodyType = 'json',
  };
  return callApi(params, req, runtime);
}

async function startCallV2(request: StartCallV2Request): StartCallV2Response {
  var runtime = new Util.RuntimeOptions{};
  return startCallV2WithOptions(request, runtime);
}

model StartChatWorkRequest {
  accountName?: string(name='AccountName'),
  instanceId?: string(name='InstanceId'),
}

model StartChatWorkResponseBody = {
  code?: string(name='Code'),
  data?: string(name='Data'),
  httpStatusCode?: int32(name='HttpStatusCode'),
  message?: string(name='Message'),
  requestId?: string(name='RequestId'),
  success?: boolean(name='Success'),
}

model StartChatWorkResponse = {
  headers: map[string]string(name='headers'),
  statusCode: int32(name='statusCode'),
  body: StartChatWorkResponseBody(name='body'),
}

async function startChatWorkWithOptions(request: StartChatWorkRequest, runtime: Util.RuntimeOptions): StartChatWorkResponse {
  Util.validateModel(request);
  var body : map[string]any = {};
  if (!Util.isUnset(request.accountName)) {
    body['AccountName'] = request.accountName;
  }
  if (!Util.isUnset(request.instanceId)) {
    body['InstanceId'] = request.instanceId;
  }
  var req = new OpenApi.OpenApiRequest{ 
    body = OpenApiUtil.parseToMap(body),
  };
  var params = new OpenApi.Params{
    action = 'StartChatWork',
    version = '2020-07-30',
    protocol = 'HTTPS',
    pathname = '/',
    method = 'POST',
    authType = 'AK',
    style = 'RPC',
    reqBodyType = 'formData',
    bodyType = 'json',
  };
  return callApi(params, req, runtime);
}

async function startChatWork(request: StartChatWorkRequest): StartChatWorkResponse {
  var runtime = new Util.RuntimeOptions{};
  return startChatWorkWithOptions(request, runtime);
}

model StartHotlineServiceRequest {
  accountName?: string(name='AccountName'),
  clientToken?: string(name='ClientToken'),
  instanceId?: string(name='InstanceId'),
}

model StartHotlineServiceResponseBody = {
  code?: string(name='Code'),
  data?: string(name='Data'),
  httpStatusCode?: long(name='HttpStatusCode'),
  message?: string(name='Message'),
  requestId?: string(name='RequestId'),
  success?: boolean(name='Success'),
}

model StartHotlineServiceResponse = {
  headers: map[string]string(name='headers'),
  statusCode: int32(name='statusCode'),
  body: StartHotlineServiceResponseBody(name='body'),
}

async function startHotlineServiceWithOptions(request: StartHotlineServiceRequest, runtime: Util.RuntimeOptions): StartHotlineServiceResponse {
  Util.validateModel(request);
  var body : map[string]any = {};
  if (!Util.isUnset(request.accountName)) {
    body['AccountName'] = request.accountName;
  }
  if (!Util.isUnset(request.clientToken)) {
    body['ClientToken'] = request.clientToken;
  }
  if (!Util.isUnset(request.instanceId)) {
    body['InstanceId'] = request.instanceId;
  }
  var req = new OpenApi.OpenApiRequest{ 
    body = OpenApiUtil.parseToMap(body),
  };
  var params = new OpenApi.Params{
    action = 'StartHotlineService',
    version = '2020-07-30',
    protocol = 'HTTPS',
    pathname = '/',
    method = 'POST',
    authType = 'AK',
    style = 'RPC',
    reqBodyType = 'formData',
    bodyType = 'json',
  };
  return callApi(params, req, runtime);
}

async function startHotlineService(request: StartHotlineServiceRequest): StartHotlineServiceResponse {
  var runtime = new Util.RuntimeOptions{};
  return startHotlineServiceWithOptions(request, runtime);
}

model SuspendHotlineServiceRequest {
  accountName?: string(name='AccountName'),
  clientToken?: string(name='ClientToken'),
  instanceId?: string(name='InstanceId'),
  type?: int32(name='Type'),
}

model SuspendHotlineServiceResponseBody = {
  code?: string(name='Code'),
  message?: string(name='Message'),
  requestId?: string(name='RequestId'),
  success?: boolean(name='Success'),
}

model SuspendHotlineServiceResponse = {
  headers: map[string]string(name='headers'),
  statusCode: int32(name='statusCode'),
  body: SuspendHotlineServiceResponseBody(name='body'),
}

async function suspendHotlineServiceWithOptions(request: SuspendHotlineServiceRequest, runtime: Util.RuntimeOptions): SuspendHotlineServiceResponse {
  Util.validateModel(request);
  var body : map[string]any = {};
  if (!Util.isUnset(request.accountName)) {
    body['AccountName'] = request.accountName;
  }
  if (!Util.isUnset(request.clientToken)) {
    body['ClientToken'] = request.clientToken;
  }
  if (!Util.isUnset(request.instanceId)) {
    body['InstanceId'] = request.instanceId;
  }
  if (!Util.isUnset(request.type)) {
    body['Type'] = request.type;
  }
  var req = new OpenApi.OpenApiRequest{ 
    body = OpenApiUtil.parseToMap(body),
  };
  var params = new OpenApi.Params{
    action = 'SuspendHotlineService',
    version = '2020-07-30',
    protocol = 'HTTPS',
    pathname = '/',
    method = 'POST',
    authType = 'AK',
    style = 'RPC',
    reqBodyType = 'formData',
    bodyType = 'json',
  };
  return callApi(params, req, runtime);
}

async function suspendHotlineService(request: SuspendHotlineServiceRequest): SuspendHotlineServiceResponse {
  var runtime = new Util.RuntimeOptions{};
  return suspendHotlineServiceWithOptions(request, runtime);
}

model ThirdPartyTransferRequest {
  instanceId?: string(name='InstanceId'),
  orgId?: string(name='OrgId'),
}

model ThirdPartyTransferResponseBody = {
  code?: string(name='Code'),
  data?: [ 
    {
      children?: string(name='Children'),
      isSelectable?: boolean(name='IsSelectable'),
      label?: string(name='Label'),
      value?: string(name='Value'),
    }
  ](name='Data'),
  httpStatusCode?: long(name='HttpStatusCode'),
  message?: string(name='Message'),
  requestId?: string(name='RequestId'),
  success?: boolean(name='Success'),
}

model ThirdPartyTransferResponse = {
  headers: map[string]string(name='headers'),
  statusCode: int32(name='statusCode'),
  body: ThirdPartyTransferResponseBody(name='body'),
}

async function thirdPartyTransferWithOptions(request: ThirdPartyTransferRequest, runtime: Util.RuntimeOptions): ThirdPartyTransferResponse {
  Util.validateModel(request);
  var body : map[string]any = {};
  if (!Util.isUnset(request.instanceId)) {
    body['InstanceId'] = request.instanceId;
  }
  if (!Util.isUnset(request.orgId)) {
    body['OrgId'] = request.orgId;
  }
  var req = new OpenApi.OpenApiRequest{ 
    body = OpenApiUtil.parseToMap(body),
  };
  var params = new OpenApi.Params{
    action = 'ThirdPartyTransfer',
    version = '2020-07-30',
    protocol = 'HTTPS',
    pathname = '/',
    method = 'POST',
    authType = 'AK',
    style = 'RPC',
    reqBodyType = 'formData',
    bodyType = 'json',
  };
  return callApi(params, req, runtime);
}

async function thirdPartyTransfer(request: ThirdPartyTransferRequest): ThirdPartyTransferResponse {
  var runtime = new Util.RuntimeOptions{};
  return thirdPartyTransferWithOptions(request, runtime);
}

model TransferCallToAgentRequest {
  accountName?: string(name='AccountName'),
  callId?: string(name='CallId'),
  clientToken?: string(name='ClientToken'),
  connectionId?: string(name='ConnectionId'),
  holdConnectionId?: string(name='HoldConnectionId'),
  instanceId?: string(name='InstanceId'),
  isSingleTransfer?: string(name='IsSingleTransfer'),
  jobId?: string(name='JobId'),
  targetAccountName?: string(name='TargetAccountName'),
  type?: int32(name='Type'),
}

model TransferCallToAgentResponseBody = {
  code?: string(name='Code'),
  message?: string(name='Message'),
  requestId?: string(name='RequestId'),
  success?: boolean(name='Success'),
}

model TransferCallToAgentResponse = {
  headers: map[string]string(name='headers'),
  statusCode: int32(name='statusCode'),
  body: TransferCallToAgentResponseBody(name='body'),
}

async function transferCallToAgentWithOptions(request: TransferCallToAgentRequest, runtime: Util.RuntimeOptions): TransferCallToAgentResponse {
  Util.validateModel(request);
  var body : map[string]any = {};
  if (!Util.isUnset(request.accountName)) {
    body['AccountName'] = request.accountName;
  }
  if (!Util.isUnset(request.callId)) {
    body['CallId'] = request.callId;
  }
  if (!Util.isUnset(request.clientToken)) {
    body['ClientToken'] = request.clientToken;
  }
  if (!Util.isUnset(request.connectionId)) {
    body['ConnectionId'] = request.connectionId;
  }
  if (!Util.isUnset(request.holdConnectionId)) {
    body['HoldConnectionId'] = request.holdConnectionId;
  }
  if (!Util.isUnset(request.instanceId)) {
    body['InstanceId'] = request.instanceId;
  }
  if (!Util.isUnset(request.isSingleTransfer)) {
    body['IsSingleTransfer'] = request.isSingleTransfer;
  }
  if (!Util.isUnset(request.jobId)) {
    body['JobId'] = request.jobId;
  }
  if (!Util.isUnset(request.targetAccountName)) {
    body['TargetAccountName'] = request.targetAccountName;
  }
  if (!Util.isUnset(request.type)) {
    body['Type'] = request.type;
  }
  var req = new OpenApi.OpenApiRequest{ 
    body = OpenApiUtil.parseToMap(body),
  };
  var params = new OpenApi.Params{
    action = 'TransferCallToAgent',
    version = '2020-07-30',
    protocol = 'HTTPS',
    pathname = '/',
    method = 'POST',
    authType = 'AK',
    style = 'RPC',
    reqBodyType = 'formData',
    bodyType = 'json',
  };
  return callApi(params, req, runtime);
}

async function transferCallToAgent(request: TransferCallToAgentRequest): TransferCallToAgentResponse {
  var runtime = new Util.RuntimeOptions{};
  return transferCallToAgentWithOptions(request, runtime);
}

model TransferCallToPhoneRequest {
  accountName?: string(name='AccountName'),
  callId?: string(name='CallId'),
  callee?: string(name='Callee'),
  caller?: string(name='Caller'),
  clientToken?: string(name='ClientToken'),
  connectionId?: string(name='ConnectionId'),
  holdConnectionId?: string(name='HoldConnectionId'),
  instanceId?: string(name='InstanceId'),
  isSingleTransfer?: boolean(name='IsSingleTransfer'),
  jobId?: string(name='JobId'),
  type?: int32(name='Type'),
  calleePhone?: string(name='calleePhone'),
  callerPhone?: string(name='callerPhone'),
}

model TransferCallToPhoneResponseBody = {
  code?: string(name='Code'),
  httpStatusCode?: long(name='HttpStatusCode'),
  message?: string(name='Message'),
  requestId?: string(name='RequestId'),
  success?: boolean(name='Success'),
}

model TransferCallToPhoneResponse = {
  headers: map[string]string(name='headers'),
  statusCode: int32(name='statusCode'),
  body: TransferCallToPhoneResponseBody(name='body'),
}

async function transferCallToPhoneWithOptions(request: TransferCallToPhoneRequest, runtime: Util.RuntimeOptions): TransferCallToPhoneResponse {
  Util.validateModel(request);
  var body : map[string]any = {};
  if (!Util.isUnset(request.accountName)) {
    body['AccountName'] = request.accountName;
  }
  if (!Util.isUnset(request.callId)) {
    body['CallId'] = request.callId;
  }
  if (!Util.isUnset(request.callee)) {
    body['Callee'] = request.callee;
  }
  if (!Util.isUnset(request.caller)) {
    body['Caller'] = request.caller;
  }
  if (!Util.isUnset(request.clientToken)) {
    body['ClientToken'] = request.clientToken;
  }
  if (!Util.isUnset(request.connectionId)) {
    body['ConnectionId'] = request.connectionId;
  }
  if (!Util.isUnset(request.holdConnectionId)) {
    body['HoldConnectionId'] = request.holdConnectionId;
  }
  if (!Util.isUnset(request.instanceId)) {
    body['InstanceId'] = request.instanceId;
  }
  if (!Util.isUnset(request.isSingleTransfer)) {
    body['IsSingleTransfer'] = request.isSingleTransfer;
  }
  if (!Util.isUnset(request.jobId)) {
    body['JobId'] = request.jobId;
  }
  if (!Util.isUnset(request.type)) {
    body['Type'] = request.type;
  }
  if (!Util.isUnset(request.calleePhone)) {
    body['calleePhone'] = request.calleePhone;
  }
  if (!Util.isUnset(request.callerPhone)) {
    body['callerPhone'] = request.callerPhone;
  }
  var req = new OpenApi.OpenApiRequest{ 
    body = OpenApiUtil.parseToMap(body),
  };
  var params = new OpenApi.Params{
    action = 'TransferCallToPhone',
    version = '2020-07-30',
    protocol = 'HTTPS',
    pathname = '/',
    method = 'POST',
    authType = 'AK',
    style = 'RPC',
    reqBodyType = 'formData',
    bodyType = 'json',
  };
  return callApi(params, req, runtime);
}

async function transferCallToPhone(request: TransferCallToPhoneRequest): TransferCallToPhoneResponse {
  var runtime = new Util.RuntimeOptions{};
  return transferCallToPhoneWithOptions(request, runtime);
}

model TransferCallToSkillGroupRequest {
  accountName?: string(name='AccountName'),
  callId?: string(name='CallId'),
  clientToken?: string(name='ClientToken'),
  connectionId?: string(name='ConnectionId'),
  holdConnectionId?: string(name='HoldConnectionId'),
  instanceId?: string(name='InstanceId'),
  isSingleTransfer?: boolean(name='IsSingleTransfer'),
  jobId?: string(name='JobId'),
  skillGroupId?: long(name='SkillGroupId'),
  type?: int32(name='Type'),
}

model TransferCallToSkillGroupResponseBody = {
  code?: string(name='Code'),
  message?: string(name='Message'),
  requestId?: string(name='RequestId'),
  success?: boolean(name='Success'),
}

model TransferCallToSkillGroupResponse = {
  headers: map[string]string(name='headers'),
  statusCode: int32(name='statusCode'),
  body: TransferCallToSkillGroupResponseBody(name='body'),
}

async function transferCallToSkillGroupWithOptions(request: TransferCallToSkillGroupRequest, runtime: Util.RuntimeOptions): TransferCallToSkillGroupResponse {
  Util.validateModel(request);
  var body : map[string]any = {};
  if (!Util.isUnset(request.accountName)) {
    body['AccountName'] = request.accountName;
  }
  if (!Util.isUnset(request.callId)) {
    body['CallId'] = request.callId;
  }
  if (!Util.isUnset(request.clientToken)) {
    body['ClientToken'] = request.clientToken;
  }
  if (!Util.isUnset(request.connectionId)) {
    body['ConnectionId'] = request.connectionId;
  }
  if (!Util.isUnset(request.holdConnectionId)) {
    body['HoldConnectionId'] = request.holdConnectionId;
  }
  if (!Util.isUnset(request.instanceId)) {
    body['InstanceId'] = request.instanceId;
  }
  if (!Util.isUnset(request.isSingleTransfer)) {
    body['IsSingleTransfer'] = request.isSingleTransfer;
  }
  if (!Util.isUnset(request.jobId)) {
    body['JobId'] = request.jobId;
  }
  if (!Util.isUnset(request.skillGroupId)) {
    body['SkillGroupId'] = request.skillGroupId;
  }
  if (!Util.isUnset(request.type)) {
    body['Type'] = request.type;
  }
  var req = new OpenApi.OpenApiRequest{ 
    body = OpenApiUtil.parseToMap(body),
  };
  var params = new OpenApi.Params{
    action = 'TransferCallToSkillGroup',
    version = '2020-07-30',
    protocol = 'HTTPS',
    pathname = '/',
    method = 'POST',
    authType = 'AK',
    style = 'RPC',
    reqBodyType = 'formData',
    bodyType = 'json',
  };
  return callApi(params, req, runtime);
}

async function transferCallToSkillGroup(request: TransferCallToSkillGroupRequest): TransferCallToSkillGroupResponse {
  var runtime = new Util.RuntimeOptions{};
  return transferCallToSkillGroupWithOptions(request, runtime);
}

model TransferToThirdCallRequest {
  accountName?: string(name='AccountName'),
  callId?: string(name='CallId'),
  clientToken?: string(name='ClientToken'),
  connectionId?: string(name='ConnectionId'),
  holdConnectionId?: string(name='HoldConnectionId'),
  instanceId?: string(name='InstanceId'),
  jobId?: string(name='JobId'),
}

model TransferToThirdCallResponseBody = {
  code?: string(name='Code'),
  message?: string(name='Message'),
  requestId?: string(name='RequestId'),
  success?: boolean(name='Success'),
}

model TransferToThirdCallResponse = {
  headers: map[string]string(name='headers'),
  statusCode: int32(name='statusCode'),
  body: TransferToThirdCallResponseBody(name='body'),
}

async function transferToThirdCallWithOptions(request: TransferToThirdCallRequest, runtime: Util.RuntimeOptions): TransferToThirdCallResponse {
  Util.validateModel(request);
  var body : map[string]any = {};
  if (!Util.isUnset(request.accountName)) {
    body['AccountName'] = request.accountName;
  }
  if (!Util.isUnset(request.callId)) {
    body['CallId'] = request.callId;
  }
  if (!Util.isUnset(request.clientToken)) {
    body['ClientToken'] = request.clientToken;
  }
  if (!Util.isUnset(request.connectionId)) {
    body['ConnectionId'] = request.connectionId;
  }
  if (!Util.isUnset(request.holdConnectionId)) {
    body['HoldConnectionId'] = request.holdConnectionId;
  }
  if (!Util.isUnset(request.instanceId)) {
    body['InstanceId'] = request.instanceId;
  }
  if (!Util.isUnset(request.jobId)) {
    body['JobId'] = request.jobId;
  }
  var req = new OpenApi.OpenApiRequest{ 
    body = OpenApiUtil.parseToMap(body),
  };
  var params = new OpenApi.Params{
    action = 'TransferToThirdCall',
    version = '2020-07-30',
    protocol = 'HTTPS',
    pathname = '/',
    method = 'POST',
    authType = 'AK',
    style = 'RPC',
    reqBodyType = 'formData',
    bodyType = 'json',
  };
  return callApi(params, req, runtime);
}

async function transferToThirdCall(request: TransferToThirdCallRequest): TransferToThirdCallResponse {
  var runtime = new Util.RuntimeOptions{};
  return transferToThirdCallWithOptions(request, runtime);
}

model UpdateAgentRequest {
  accountName?: string(name='AccountName'),
  clientToken?: string(name='ClientToken'),
  displayName?: string(name='DisplayName'),
  instanceId?: string(name='InstanceId'),
  skillGroupId?: [ long ](name='SkillGroupId'),
  skillGroupIdList?: [ long ](name='SkillGroupIdList'),
}

model UpdateAgentResponseBody = {
  code?: string(name='Code'),
  httpStatusCode?: long(name='HttpStatusCode'),
  message?: string(name='Message'),
  requestId?: string(name='RequestId'),
  success?: boolean(name='Success'),
}

model UpdateAgentResponse = {
  headers: map[string]string(name='headers'),
  statusCode: int32(name='statusCode'),
  body: UpdateAgentResponseBody(name='body'),
}

async function updateAgentWithOptions(request: UpdateAgentRequest, runtime: Util.RuntimeOptions): UpdateAgentResponse {
  Util.validateModel(request);
  var body : map[string]any = {};
  if (!Util.isUnset(request.accountName)) {
    body['AccountName'] = request.accountName;
  }
  if (!Util.isUnset(request.clientToken)) {
    body['ClientToken'] = request.clientToken;
  }
  if (!Util.isUnset(request.displayName)) {
    body['DisplayName'] = request.displayName;
  }
  if (!Util.isUnset(request.instanceId)) {
    body['InstanceId'] = request.instanceId;
  }
  if (!Util.isUnset(request.skillGroupId)) {
    body['SkillGroupId'] = request.skillGroupId;
  }
  if (!Util.isUnset(request.skillGroupIdList)) {
    body['SkillGroupIdList'] = request.skillGroupIdList;
  }
  var req = new OpenApi.OpenApiRequest{ 
    body = OpenApiUtil.parseToMap(body),
  };
  var params = new OpenApi.Params{
    action = 'UpdateAgent',
    version = '2020-07-30',
    protocol = 'HTTPS',
    pathname = '/',
    method = 'PUT',
    authType = 'AK',
    style = 'RPC',
    reqBodyType = 'formData',
    bodyType = 'json',
  };
  return callApi(params, req, runtime);
}

async function updateAgent(request: UpdateAgentRequest): UpdateAgentResponse {
  var runtime = new Util.RuntimeOptions{};
  return updateAgentWithOptions(request, runtime);
}

model UpdateCustomerRequest {
  bizType?: string(name='BizType'),
  contacter?: string(name='Contacter'),
  customerId?: long(name='CustomerId'),
  dingding?: string(name='Dingding'),
  email?: string(name='Email'),
  industry?: string(name='Industry'),
  instanceId?: string(name='InstanceId'),
  managerName?: string(name='ManagerName'),
  name?: string(name='Name'),
  outerId?: string(name='OuterId'),
  outerIdType?: int32(name='OuterIdType'),
  phone?: string(name='Phone'),
  position?: string(name='Position'),
  prodLineId?: long(name='ProdLineId'),
  typeCode?: string(name='TypeCode'),
}

model UpdateCustomerResponseBody = {
  code?: string(name='Code'),
  data?: long(name='Data'),
  message?: string(name='Message'),
  requestId?: string(name='RequestId'),
  success?: boolean(name='Success'),
}

model UpdateCustomerResponse = {
  headers: map[string]string(name='headers'),
  statusCode: int32(name='statusCode'),
  body: UpdateCustomerResponseBody(name='body'),
}

async function updateCustomerWithOptions(request: UpdateCustomerRequest, runtime: Util.RuntimeOptions): UpdateCustomerResponse {
  Util.validateModel(request);
  var query = {};
  if (!Util.isUnset(request.bizType)) {
    query['BizType'] = request.bizType;
  }
  if (!Util.isUnset(request.contacter)) {
    query['Contacter'] = request.contacter;
  }
  if (!Util.isUnset(request.customerId)) {
    query['CustomerId'] = request.customerId;
  }
  if (!Util.isUnset(request.dingding)) {
    query['Dingding'] = request.dingding;
  }
  if (!Util.isUnset(request.email)) {
    query['Email'] = request.email;
  }
  if (!Util.isUnset(request.industry)) {
    query['Industry'] = request.industry;
  }
  if (!Util.isUnset(request.instanceId)) {
    query['InstanceId'] = request.instanceId;
  }
  if (!Util.isUnset(request.managerName)) {
    query['ManagerName'] = request.managerName;
  }
  if (!Util.isUnset(request.name)) {
    query['Name'] = request.name;
  }
  if (!Util.isUnset(request.outerId)) {
    query['OuterId'] = request.outerId;
  }
  if (!Util.isUnset(request.outerIdType)) {
    query['OuterIdType'] = request.outerIdType;
  }
  if (!Util.isUnset(request.phone)) {
    query['Phone'] = request.phone;
  }
  if (!Util.isUnset(request.position)) {
    query['Position'] = request.position;
  }
  if (!Util.isUnset(request.prodLineId)) {
    query['ProdLineId'] = request.prodLineId;
  }
  if (!Util.isUnset(request.typeCode)) {
    query['TypeCode'] = request.typeCode;
  }
  var req = new OpenApi.OpenApiRequest{ 
    query = OpenApiUtil.query(query),
  };
  var params = new OpenApi.Params{
    action = 'UpdateCustomer',
    version = '2020-07-30',
    protocol = 'HTTPS',
    pathname = '/',
    method = 'POST',
    authType = 'AK',
    style = 'RPC',
    reqBodyType = 'formData',
    bodyType = 'json',
  };
  return callApi(params, req, runtime);
}

async function updateCustomer(request: UpdateCustomerRequest): UpdateCustomerResponse {
  var runtime = new Util.RuntimeOptions{};
  return updateCustomerWithOptions(request, runtime);
}

model UpdateEntityTagRelationRequest {
  entityTagParam?: string(name='EntityTagParam'),
  instanceId?: string(name='InstanceId'),
}

model UpdateEntityTagRelationResponseBody = {
  code?: string(name='Code'),
  data?: string(name='Data'),
  message?: string(name='Message'),
  requestId?: string(name='RequestId'),
  success?: boolean(name='Success'),
}

model UpdateEntityTagRelationResponse = {
  headers: map[string]string(name='headers'),
  statusCode: int32(name='statusCode'),
  body: UpdateEntityTagRelationResponseBody(name='body'),
}

async function updateEntityTagRelationWithOptions(request: UpdateEntityTagRelationRequest, runtime: Util.RuntimeOptions): UpdateEntityTagRelationResponse {
  Util.validateModel(request);
  var body : map[string]any = {};
  if (!Util.isUnset(request.entityTagParam)) {
    body['EntityTagParam'] = request.entityTagParam;
  }
  if (!Util.isUnset(request.instanceId)) {
    body['InstanceId'] = request.instanceId;
  }
  var req = new OpenApi.OpenApiRequest{ 
    body = OpenApiUtil.parseToMap(body),
  };
  var params = new OpenApi.Params{
    action = 'UpdateEntityTagRelation',
    version = '2020-07-30',
    protocol = 'HTTPS',
    pathname = '/',
    method = 'POST',
    authType = 'AK',
    style = 'RPC',
    reqBodyType = 'formData',
    bodyType = 'json',
  };
  return callApi(params, req, runtime);
}

async function updateEntityTagRelation(request: UpdateEntityTagRelationRequest): UpdateEntityTagRelationResponse {
  var runtime = new Util.RuntimeOptions{};
  return updateEntityTagRelationWithOptions(request, runtime);
}

model UpdateRingStatusRequest {
  callOutStatus?: string(name='CallOutStatus'),
  extra?: string(name='Extra'),
  instanceId?: string(name='InstanceId'),
  uniqueBizId?: string(name='UniqueBizId'),
}

model UpdateRingStatusResponseBody = {
  code?: string(name='Code'),
  data?: string(name='Data'),
  httpStatusCode?: long(name='HttpStatusCode'),
  message?: string(name='Message'),
  requestId?: string(name='RequestId'),
  success?: boolean(name='Success'),
}

model UpdateRingStatusResponse = {
  headers: map[string]string(name='headers'),
  statusCode: int32(name='statusCode'),
  body: UpdateRingStatusResponseBody(name='body'),
}

async function updateRingStatusWithOptions(request: UpdateRingStatusRequest, runtime: Util.RuntimeOptions): UpdateRingStatusResponse {
  Util.validateModel(request);
  var body : map[string]any = {};
  if (!Util.isUnset(request.callOutStatus)) {
    body['CallOutStatus'] = request.callOutStatus;
  }
  if (!Util.isUnset(request.extra)) {
    body['Extra'] = request.extra;
  }
  if (!Util.isUnset(request.instanceId)) {
    body['InstanceId'] = request.instanceId;
  }
  if (!Util.isUnset(request.uniqueBizId)) {
    body['UniqueBizId'] = request.uniqueBizId;
  }
  var req = new OpenApi.OpenApiRequest{ 
    body = OpenApiUtil.parseToMap(body),
  };
  var params = new OpenApi.Params{
    action = 'UpdateRingStatus',
    version = '2020-07-30',
    protocol = 'HTTPS',
    pathname = '/',
    method = 'POST',
    authType = 'AK',
    style = 'RPC',
    reqBodyType = 'formData',
    bodyType = 'json',
  };
  return callApi(params, req, runtime);
}

async function updateRingStatus(request: UpdateRingStatusRequest): UpdateRingStatusResponse {
  var runtime = new Util.RuntimeOptions{};
  return updateRingStatusWithOptions(request, runtime);
}

model UpdateRoleRequest {
  clientToken?: string(name='ClientToken'),
  instanceId?: string(name='InstanceId'),
  operator?: string(name='Operator'),
  permissionId?: [ long ](name='PermissionId'),
  roleId?: long(name='RoleId'),
  roleName?: string(name='RoleName'),
}

model UpdateRoleResponseBody = {
  code?: string(name='Code'),
  httpStatusCode?: long(name='HttpStatusCode'),
  message?: string(name='Message'),
  requestId?: string(name='RequestId'),
  success?: boolean(name='Success'),
}

model UpdateRoleResponse = {
  headers: map[string]string(name='headers'),
  statusCode: int32(name='statusCode'),
  body: UpdateRoleResponseBody(name='body'),
}

async function updateRoleWithOptions(request: UpdateRoleRequest, runtime: Util.RuntimeOptions): UpdateRoleResponse {
  Util.validateModel(request);
  var body : map[string]any = {};
  if (!Util.isUnset(request.clientToken)) {
    body['ClientToken'] = request.clientToken;
  }
  if (!Util.isUnset(request.instanceId)) {
    body['InstanceId'] = request.instanceId;
  }
  if (!Util.isUnset(request.operator)) {
    body['Operator'] = request.operator;
  }
  if (!Util.isUnset(request.permissionId)) {
    body['PermissionId'] = request.permissionId;
  }
  if (!Util.isUnset(request.roleId)) {
    body['RoleId'] = request.roleId;
  }
  if (!Util.isUnset(request.roleName)) {
    body['RoleName'] = request.roleName;
  }
  var req = new OpenApi.OpenApiRequest{ 
    body = OpenApiUtil.parseToMap(body),
  };
  var params = new OpenApi.Params{
    action = 'UpdateRole',
    version = '2020-07-30',
    protocol = 'HTTPS',
    pathname = '/',
    method = 'POST',
    authType = 'AK',
    style = 'RPC',
    reqBodyType = 'formData',
    bodyType = 'json',
  };
  return callApi(params, req, runtime);
}

async function updateRole(request: UpdateRoleRequest): UpdateRoleResponse {
  var runtime = new Util.RuntimeOptions{};
  return updateRoleWithOptions(request, runtime);
}

model UpdateSkillGroupRequest {
  channelType?: long(name='ChannelType'),
  clientToken?: string(name='ClientToken'),
  description?: string(name='Description'),
  displayName?: string(name='DisplayName'),
  instanceId?: string(name='InstanceId'),
  skillGroupId?: long(name='SkillGroupId'),
  skillGroupName?: string(name='SkillGroupName'),
}

model UpdateSkillGroupResponseBody = {
  code?: string(name='Code'),
  httpStatusCode?: long(name='HttpStatusCode'),
  message?: string(name='Message'),
  requestId?: string(name='RequestId'),
  success?: boolean(name='Success'),
}

model UpdateSkillGroupResponse = {
  headers: map[string]string(name='headers'),
  statusCode: int32(name='statusCode'),
  body: UpdateSkillGroupResponseBody(name='body'),
}

async function updateSkillGroupWithOptions(request: UpdateSkillGroupRequest, runtime: Util.RuntimeOptions): UpdateSkillGroupResponse {
  Util.validateModel(request);
  var query = {};
  if (!Util.isUnset(request.channelType)) {
    query['ChannelType'] = request.channelType;
  }
  if (!Util.isUnset(request.clientToken)) {
    query['ClientToken'] = request.clientToken;
  }
  if (!Util.isUnset(request.description)) {
    query['Description'] = request.description;
  }
  if (!Util.isUnset(request.displayName)) {
    query['DisplayName'] = request.displayName;
  }
  if (!Util.isUnset(request.instanceId)) {
    query['InstanceId'] = request.instanceId;
  }
  if (!Util.isUnset(request.skillGroupId)) {
    query['SkillGroupId'] = request.skillGroupId;
  }
  if (!Util.isUnset(request.skillGroupName)) {
    query['SkillGroupName'] = request.skillGroupName;
  }
  var req = new OpenApi.OpenApiRequest{ 
    query = OpenApiUtil.query(query),
  };
  var params = new OpenApi.Params{
    action = 'UpdateSkillGroup',
    version = '2020-07-30',
    protocol = 'HTTPS',
    pathname = '/',
    method = 'POST',
    authType = 'AK',
    style = 'RPC',
    reqBodyType = 'formData',
    bodyType = 'json',
  };
  return callApi(params, req, runtime);
}

async function updateSkillGroup(request: UpdateSkillGroupRequest): UpdateSkillGroupResponse {
  var runtime = new Util.RuntimeOptions{};
  return updateSkillGroupWithOptions(request, runtime);
}

model UpdateTicketRequest {
  clientToken?: string(name='ClientToken'),
  formData?: string(name='FormData'),
  instanceId?: string(name='InstanceId'),
  operatorId?: long(name='OperatorId'),
  ticketId?: long(name='TicketId'),
}

model UpdateTicketResponseBody = {
  code?: string(name='Code'),
  httpStatusCode?: long(name='HttpStatusCode'),
  message?: string(name='Message'),
  requestId?: string(name='RequestId'),
  success?: boolean(name='Success'),
}

model UpdateTicketResponse = {
  headers: map[string]string(name='headers'),
  statusCode: int32(name='statusCode'),
  body: UpdateTicketResponseBody(name='body'),
}

async function updateTicketWithOptions(request: UpdateTicketRequest, runtime: Util.RuntimeOptions): UpdateTicketResponse {
  Util.validateModel(request);
  var body : map[string]any = {};
  if (!Util.isUnset(request.clientToken)) {
    body['ClientToken'] = request.clientToken;
  }
  if (!Util.isUnset(request.formData)) {
    body['FormData'] = request.formData;
  }
  if (!Util.isUnset(request.instanceId)) {
    body['InstanceId'] = request.instanceId;
  }
  if (!Util.isUnset(request.operatorId)) {
    body['OperatorId'] = request.operatorId;
  }
  if (!Util.isUnset(request.ticketId)) {
    body['TicketId'] = request.ticketId;
  }
  var req = new OpenApi.OpenApiRequest{ 
    body = OpenApiUtil.parseToMap(body),
  };
  var params = new OpenApi.Params{
    action = 'UpdateTicket',
    version = '2020-07-30',
    protocol = 'HTTPS',
    pathname = '/',
    method = 'POST',
    authType = 'AK',
    style = 'RPC',
    reqBodyType = 'formData',
    bodyType = 'json',
  };
  return callApi(params, req, runtime);
}

async function updateTicket(request: UpdateTicketRequest): UpdateTicketResponse {
  var runtime = new Util.RuntimeOptions{};
  return updateTicketWithOptions(request, runtime);
}

model UpdateTicketAllRequest {
  buId?: long(name='BuId'),
  caseId?: long(name='CaseId'),
  caseType?: int32(name='CaseType'),
  categoryId?: long(name='CategoryId'),
  cc?: string(name='Cc'),
  channelId?: string(name='ChannelId'),
  channelType?: int32(name='ChannelType'),
  clientToken?: string(name='ClientToken'),
  createdTime?: string(name='CreatedTime'),
  creatorId?: long(name='CreatorId'),
  creatorName?: string(name='CreatorName'),
  creatorType?: int32(name='CreatorType'),
  departmentId?: long(name='DepartmentId'),
  endTime?: string(name='EndTime'),
  extAttr?: string(name='ExtAttr'),
  feedback?: string(name='Feedback'),
  fromInfo?: string(name='FromInfo'),
  header?: {
    stateVersion?: int32(name='StateVersion'),
    version?: int32(name='Version'),
  }(name='Header'),
  instanceId?: string(name='InstanceId'),
  memberId?: long(name='MemberId'),
  memberName?: string(name='MemberName'),
  memberType?: int32(name='MemberType'),
  modifiedTime?: string(name='ModifiedTime'),
  otherFields?: map[string]any(name='OtherFields'),
  parentCaseId?: long(name='ParentCaseId'),
  planEndTime?: string(name='PlanEndTime'),
  priority?: int32(name='Priority'),
  refCaseId?: long(name='RefCaseId'),
  status?: int32(name='Status'),
  tag?: string(name='Tag'),
  templateId?: long(name='TemplateId'),
  touchId?: long(name='TouchId'),
}

model UpdateTicketAllResponseBody = {
  code?: string(name='Code'),
  data?: string(name='Data'),
  httpStatusCode?: int32(name='HttpStatusCode'),
  message?: string(name='Message'),
  requestId?: string(name='RequestId'),
  success?: boolean(name='Success'),
}

model UpdateTicketAllResponse = {
  headers: map[string]string(name='headers'),
  statusCode: int32(name='statusCode'),
  body: UpdateTicketAllResponseBody(name='body'),
}

async function updateTicketAllWithOptions(request: UpdateTicketAllRequest, runtime: Util.RuntimeOptions): UpdateTicketAllResponse {
  Util.validateModel(request);
  var body : map[string]any = {};
  if (!Util.isUnset(request.buId)) {
    body['BuId'] = request.buId;
  }
  if (!Util.isUnset(request.caseId)) {
    body['CaseId'] = request.caseId;
  }
  if (!Util.isUnset(request.caseType)) {
    body['CaseType'] = request.caseType;
  }
  if (!Util.isUnset(request.categoryId)) {
    body['CategoryId'] = request.categoryId;
  }
  if (!Util.isUnset(request.cc)) {
    body['Cc'] = request.cc;
  }
  if (!Util.isUnset(request.channelId)) {
    body['ChannelId'] = request.channelId;
  }
  if (!Util.isUnset(request.channelType)) {
    body['ChannelType'] = request.channelType;
  }
  if (!Util.isUnset(request.clientToken)) {
    body['ClientToken'] = request.clientToken;
  }
  if (!Util.isUnset(request.createdTime)) {
    body['CreatedTime'] = request.createdTime;
  }
  if (!Util.isUnset(request.creatorId)) {
    body['CreatorId'] = request.creatorId;
  }
  if (!Util.isUnset(request.creatorName)) {
    body['CreatorName'] = request.creatorName;
  }
  if (!Util.isUnset(request.creatorType)) {
    body['CreatorType'] = request.creatorType;
  }
  if (!Util.isUnset(request.departmentId)) {
    body['DepartmentId'] = request.departmentId;
  }
  if (!Util.isUnset(request.endTime)) {
    body['EndTime'] = request.endTime;
  }
  if (!Util.isUnset(request.extAttr)) {
    body['ExtAttr'] = request.extAttr;
  }
  if (!Util.isUnset(request.feedback)) {
    body['Feedback'] = request.feedback;
  }
  if (!Util.isUnset(request.fromInfo)) {
    body['FromInfo'] = request.fromInfo;
  }
  var bodyFlat : map[string]any = {};
  if (!Util.isUnset(request.header)) {
    bodyFlat['Header'] = request.header;
  }
  if (!Util.isUnset(request.instanceId)) {
    body['InstanceId'] = request.instanceId;
  }
  if (!Util.isUnset(request.memberId)) {
    body['MemberId'] = request.memberId;
  }
  if (!Util.isUnset(request.memberName)) {
    body['MemberName'] = request.memberName;
  }
  if (!Util.isUnset(request.memberType)) {
    body['MemberType'] = request.memberType;
  }
  if (!Util.isUnset(request.modifiedTime)) {
    body['ModifiedTime'] = request.modifiedTime;
  }
  if (!Util.isUnset(request.otherFields)) {
    bodyFlat['OtherFields'] = request.otherFields;
  }
  if (!Util.isUnset(request.parentCaseId)) {
    body['ParentCaseId'] = request.parentCaseId;
  }
  if (!Util.isUnset(request.planEndTime)) {
    body['PlanEndTime'] = request.planEndTime;
  }
  if (!Util.isUnset(request.priority)) {
    body['Priority'] = request.priority;
  }
  if (!Util.isUnset(request.refCaseId)) {
    body['RefCaseId'] = request.refCaseId;
  }
  if (!Util.isUnset(request.status)) {
    body['Status'] = request.status;
  }
  if (!Util.isUnset(request.tag)) {
    body['Tag'] = request.tag;
  }
  if (!Util.isUnset(request.templateId)) {
    body['TemplateId'] = request.templateId;
  }
  if (!Util.isUnset(request.touchId)) {
    body['TouchId'] = request.touchId;
  }
  body = {
    ...body,
    ...OpenApiUtil.query(bodyFlat),
  };

  var req = new OpenApi.OpenApiRequest{ 
    body = OpenApiUtil.parseToMap(body),
  };
  var params = new OpenApi.Params{
    action = 'UpdateTicketAll',
    version = '2020-07-30',
    protocol = 'HTTPS',
    pathname = '/',
    method = 'POST',
    authType = 'AK',
    style = 'RPC',
    reqBodyType = 'formData',
    bodyType = 'json',
  };
  return callApi(params, req, runtime);
}

async function updateTicketAll(request: UpdateTicketAllRequest): UpdateTicketAllResponse {
  var runtime = new Util.RuntimeOptions{};
  return updateTicketAllWithOptions(request, runtime);
}

model UpdateTicketAndStatusRequest {
  appealInfo?: string(name='AppealInfo'),
  caseChannel?: int32(name='CaseChannel'),
  caseId?: long(name='CaseId'),
  caseStatus?: int32(name='CaseStatus'),
  clientToken?: string(name='ClientToken'),
  enclosureUrl?: [ 
    {
      name?: string(name='Name'),
      status?: string(name='Status'),
      uid?: string(name='Uid'),
      url?: string(name='Url'),
    }
  ](name='EnclosureUrl'),
  instanceId?: string(name='InstanceId'),
  isAppeal?: boolean(name='IsAppeal'),
  statusInfo?: string(name='StatusInfo'),
}

model UpdateTicketAndStatusResponseBody = {
  code?: string(name='Code'),
  data?: string(name='Data'),
  httpStatusCode?: int32(name='HttpStatusCode'),
  message?: string(name='Message'),
  requestId?: string(name='RequestId'),
  success?: boolean(name='Success'),
}

model UpdateTicketAndStatusResponse = {
  headers: map[string]string(name='headers'),
  statusCode: int32(name='statusCode'),
  body: UpdateTicketAndStatusResponseBody(name='body'),
}

async function updateTicketAndStatusWithOptions(request: UpdateTicketAndStatusRequest, runtime: Util.RuntimeOptions): UpdateTicketAndStatusResponse {
  Util.validateModel(request);
  var query = OpenApiUtil.query(Util.toMap(request));
  var req = new OpenApi.OpenApiRequest{ 
    query = OpenApiUtil.query(query),
  };
  var params = new OpenApi.Params{
    action = 'UpdateTicketAndStatus',
    version = '2020-07-30',
    protocol = 'HTTPS',
    pathname = '/',
    method = 'GET',
    authType = 'AK',
    style = 'RPC',
    reqBodyType = 'formData',
    bodyType = 'json',
  };
  return callApi(params, req, runtime);
}

async function updateTicketAndStatus(request: UpdateTicketAndStatusRequest): UpdateTicketAndStatusResponse {
  var runtime = new Util.RuntimeOptions{};
  return updateTicketAndStatusWithOptions(request, runtime);
}

model XspaceAddIdpXspaceAccountRequest {
  clientId?: string(name='ClientId'),
  showName?: string(name='ShowName'),
  tenantId?: long(name='TenantId'),
  userId?: string(name='UserId'),
  userName?: string(name='UserName'),
}

model XspaceAddIdpXspaceAccountResponseBody = {
  code?: string(name='Code'),
  data?: long(name='Data'),
  httpStatusCode?: long(name='HttpStatusCode'),
  message?: string(name='Message'),
  requestId?: string(name='RequestId'),
  success?: boolean(name='Success'),
}

model XspaceAddIdpXspaceAccountResponse = {
  headers: map[string]string(name='headers'),
  statusCode: int32(name='statusCode'),
  body: XspaceAddIdpXspaceAccountResponseBody(name='body'),
}

async function xspaceAddIdpXspaceAccountWithOptions(request: XspaceAddIdpXspaceAccountRequest, runtime: Util.RuntimeOptions): XspaceAddIdpXspaceAccountResponse {
  Util.validateModel(request);
  var query = {};
  if (!Util.isUnset(request.clientId)) {
    query['ClientId'] = request.clientId;
  }
  if (!Util.isUnset(request.showName)) {
    query['ShowName'] = request.showName;
  }
  if (!Util.isUnset(request.tenantId)) {
    query['TenantId'] = request.tenantId;
  }
  if (!Util.isUnset(request.userId)) {
    query['UserId'] = request.userId;
  }
  if (!Util.isUnset(request.userName)) {
    query['UserName'] = request.userName;
  }
  var req = new OpenApi.OpenApiRequest{ 
    query = OpenApiUtil.query(query),
  };
  var params = new OpenApi.Params{
    action = 'XspaceAddIdpXspaceAccount',
    version = '2020-07-30',
    protocol = 'HTTPS',
    pathname = '/',
    method = 'POST',
    authType = 'AK',
    style = 'RPC',
    reqBodyType = 'formData',
    bodyType = 'json',
  };
  return callApi(params, req, runtime);
}

async function xspaceAddIdpXspaceAccount(request: XspaceAddIdpXspaceAccountRequest): XspaceAddIdpXspaceAccountResponse {
  var runtime = new Util.RuntimeOptions{};
  return xspaceAddIdpXspaceAccountWithOptions(request, runtime);
}

model XspaceDeleteServicerRequest {
  servicerId?: long(name='ServicerId'),
  tenantId?: long(name='TenantId'),
}

model XspaceDeleteServicerResponseBody = {
  code?: string(name='Code'),
  httpStatusCode?: long(name='HttpStatusCode'),
  message?: string(name='Message'),
  requestId?: string(name='RequestId'),
  success?: boolean(name='Success'),
}

model XspaceDeleteServicerResponse = {
  headers: map[string]string(name='headers'),
  statusCode: int32(name='statusCode'),
  body: XspaceDeleteServicerResponseBody(name='body'),
}

async function xspaceDeleteServicerWithOptions(request: XspaceDeleteServicerRequest, runtime: Util.RuntimeOptions): XspaceDeleteServicerResponse {
  Util.validateModel(request);
  var query = {};
  if (!Util.isUnset(request.servicerId)) {
    query['ServicerId'] = request.servicerId;
  }
  if (!Util.isUnset(request.tenantId)) {
    query['TenantId'] = request.tenantId;
  }
  var req = new OpenApi.OpenApiRequest{ 
    query = OpenApiUtil.query(query),
  };
  var params = new OpenApi.Params{
    action = 'XspaceDeleteServicer',
    version = '2020-07-30',
    protocol = 'HTTPS',
    pathname = '/',
    method = 'POST',
    authType = 'AK',
    style = 'RPC',
    reqBodyType = 'formData',
    bodyType = 'json',
  };
  return callApi(params, req, runtime);
}

async function xspaceDeleteServicer(request: XspaceDeleteServicerRequest): XspaceDeleteServicerResponse {
  var runtime = new Util.RuntimeOptions{};
  return xspaceDeleteServicerWithOptions(request, runtime);
}

model XspaceGetInstanceIdByBuIdRequest {
  tenantId?: long(name='TenantId'),
}

model XspaceGetInstanceIdByBuIdResponseBody = {
  code?: string(name='Code'),
  data?: {
    instanceId?: string(name='InstanceId'),
    instanceName?: string(name='InstanceName'),
    tenantId?: long(name='TenantId'),
  }(name='Data'),
  httpStatusCode?: long(name='HttpStatusCode'),
  message?: string(name='Message'),
  requestId?: string(name='RequestId'),
  success?: boolean(name='Success'),
}

model XspaceGetInstanceIdByBuIdResponse = {
  headers: map[string]string(name='headers'),
  statusCode: int32(name='statusCode'),
  body: XspaceGetInstanceIdByBuIdResponseBody(name='body'),
}

async function xspaceGetInstanceIdByBuIdWithOptions(request: XspaceGetInstanceIdByBuIdRequest, runtime: Util.RuntimeOptions): XspaceGetInstanceIdByBuIdResponse {
  Util.validateModel(request);
  var query = {};
  if (!Util.isUnset(request.tenantId)) {
    query['TenantId'] = request.tenantId;
  }
  var req = new OpenApi.OpenApiRequest{ 
    query = OpenApiUtil.query(query),
  };
  var params = new OpenApi.Params{
    action = 'XspaceGetInstanceIdByBuId',
    version = '2020-07-30',
    protocol = 'HTTPS',
    pathname = '/',
    method = 'POST',
    authType = 'AK',
    style = 'RPC',
    reqBodyType = 'formData',
    bodyType = 'json',
  };
  return callApi(params, req, runtime);
}

async function xspaceGetInstanceIdByBuId(request: XspaceGetInstanceIdByBuIdRequest): XspaceGetInstanceIdByBuIdResponse {
  var runtime = new Util.RuntimeOptions{};
  return xspaceGetInstanceIdByBuIdWithOptions(request, runtime);
}

model XspaceNextbotChatRequest {
  channel?: string(name='Channel'),
  conversationId?: string(name='ConversationId'),
  instanceId?: string(name='InstanceId'),
  knowledgeId?: string(name='KnowledgeId'),
  question?: string(name='Question'),
  robotId?: string(name='RobotId'),
  senderId?: string(name='SenderId'),
  senderNick?: string(name='SenderNick'),
  sessionId?: string(name='SessionId'),
  tenantId?: long(name='TenantId'),
}

model XspaceNextbotChatResponseBody = {
  code?: string(name='Code'),
  data?: {
    message?: string(name='message'),
    messageId?: string(name='messageId'),
    requestId?: string(name='requestId'),
    sessionId?: string(name='sessionId'),
  }(name='Data'),
  httpStatusCode?: long(name='HttpStatusCode'),
  message?: string(name='Message'),
  requestId?: string(name='RequestId'),
  success?: boolean(name='Success'),
}

model XspaceNextbotChatResponse = {
  headers: map[string]string(name='headers'),
  statusCode: int32(name='statusCode'),
  body: XspaceNextbotChatResponseBody(name='body'),
}

async function xspaceNextbotChatWithOptions(request: XspaceNextbotChatRequest, runtime: Util.RuntimeOptions): XspaceNextbotChatResponse {
  Util.validateModel(request);
  var query = {};
  if (!Util.isUnset(request.channel)) {
    query['Channel'] = request.channel;
  }
  if (!Util.isUnset(request.conversationId)) {
    query['ConversationId'] = request.conversationId;
  }
  if (!Util.isUnset(request.instanceId)) {
    query['InstanceId'] = request.instanceId;
  }
  if (!Util.isUnset(request.knowledgeId)) {
    query['KnowledgeId'] = request.knowledgeId;
  }
  if (!Util.isUnset(request.question)) {
    query['Question'] = request.question;
  }
  if (!Util.isUnset(request.robotId)) {
    query['RobotId'] = request.robotId;
  }
  if (!Util.isUnset(request.senderId)) {
    query['SenderId'] = request.senderId;
  }
  if (!Util.isUnset(request.senderNick)) {
    query['SenderNick'] = request.senderNick;
  }
  if (!Util.isUnset(request.sessionId)) {
    query['SessionId'] = request.sessionId;
  }
  if (!Util.isUnset(request.tenantId)) {
    query['TenantId'] = request.tenantId;
  }
  var req = new OpenApi.OpenApiRequest{ 
    query = OpenApiUtil.query(query),
  };
  var params = new OpenApi.Params{
    action = 'XspaceNextbotChat',
    version = '2020-07-30',
    protocol = 'HTTPS',
    pathname = '/',
    method = 'POST',
    authType = 'AK',
    style = 'RPC',
    reqBodyType = 'formData',
    bodyType = 'json',
  };
  return callApi(params, req, runtime);
}

async function xspaceNextbotChat(request: XspaceNextbotChatRequest): XspaceNextbotChatResponse {
  var runtime = new Util.RuntimeOptions{};
  return xspaceNextbotChatWithOptions(request, runtime);
}

model XspaceNextbotCreateAliyunInstanceRequest {
  instanceId?: string(name='InstanceId'),
  instanceName?: string(name='InstanceName'),
  pid?: string(name='Pid'),
  productSource?: long(name='ProductSource'),
  saleEnv?: string(name='SaleEnv'),
  saleRegion?: string(name='SaleRegion'),
  tenantId?: long(name='TenantId'),
}

model XspaceNextbotCreateAliyunInstanceResponseBody = {
  code?: string(name='Code'),
  data?: {
    instanceId?: string(name='InstanceId'),
    instanceName?: string(name='InstanceName'),
    tenantId?: long(name='TenantId'),
  }(name='Data'),
  httpStatusCode?: long(name='HttpStatusCode'),
  message?: string(name='Message'),
  requestId?: string(name='RequestId'),
  success?: boolean(name='Success'),
}

model XspaceNextbotCreateAliyunInstanceResponse = {
  headers: map[string]string(name='headers'),
  statusCode: int32(name='statusCode'),
  body: XspaceNextbotCreateAliyunInstanceResponseBody(name='body'),
}

async function xspaceNextbotCreateAliyunInstanceWithOptions(request: XspaceNextbotCreateAliyunInstanceRequest, runtime: Util.RuntimeOptions): XspaceNextbotCreateAliyunInstanceResponse {
  Util.validateModel(request);
  var query = {};
  if (!Util.isUnset(request.instanceId)) {
    query['InstanceId'] = request.instanceId;
  }
  if (!Util.isUnset(request.instanceName)) {
    query['InstanceName'] = request.instanceName;
  }
  if (!Util.isUnset(request.pid)) {
    query['Pid'] = request.pid;
  }
  if (!Util.isUnset(request.productSource)) {
    query['ProductSource'] = request.productSource;
  }
  if (!Util.isUnset(request.saleEnv)) {
    query['SaleEnv'] = request.saleEnv;
  }
  if (!Util.isUnset(request.saleRegion)) {
    query['SaleRegion'] = request.saleRegion;
  }
  if (!Util.isUnset(request.tenantId)) {
    query['TenantId'] = request.tenantId;
  }
  var req = new OpenApi.OpenApiRequest{ 
    query = OpenApiUtil.query(query),
  };
  var params = new OpenApi.Params{
    action = 'XspaceNextbotCreateAliyunInstance',
    version = '2020-07-30',
    protocol = 'HTTPS',
    pathname = '/',
    method = 'POST',
    authType = 'AK',
    style = 'RPC',
    reqBodyType = 'formData',
    bodyType = 'json',
  };
  return callApi(params, req, runtime);
}

async function xspaceNextbotCreateAliyunInstance(request: XspaceNextbotCreateAliyunInstanceRequest): XspaceNextbotCreateAliyunInstanceResponse {
  var runtime = new Util.RuntimeOptions{};
  return xspaceNextbotCreateAliyunInstanceWithOptions(request, runtime);
}

model XspaceNextbotCreateAndGetInstanceIdRequest {
  buId?: string(name='BuId'),
  buName?: string(name='BuName'),
  instanceId?: string(name='InstanceId'),
  instanceName?: string(name='InstanceName'),
  pid?: string(name='Pid'),
  productSource?: long(name='ProductSource'),
  saleEnv?: string(name='SaleEnv'),
  saleRegion?: string(name='SaleRegion'),
}

model XspaceNextbotCreateAndGetInstanceIdResponseBody = {
  code?: string(name='Code'),
  data?: {
    instanceId?: string(name='InstanceId'),
    instanceName?: string(name='InstanceName'),
    tenantId?: long(name='TenantId'),
  }(name='Data'),
  httpStatusCode?: long(name='HttpStatusCode'),
  message?: string(name='Message'),
  requestId?: string(name='RequestId'),
  success?: boolean(name='Success'),
}

model XspaceNextbotCreateAndGetInstanceIdResponse = {
  headers: map[string]string(name='headers'),
  statusCode: int32(name='statusCode'),
  body: XspaceNextbotCreateAndGetInstanceIdResponseBody(name='body'),
}

async function xspaceNextbotCreateAndGetInstanceIdWithOptions(request: XspaceNextbotCreateAndGetInstanceIdRequest, runtime: Util.RuntimeOptions): XspaceNextbotCreateAndGetInstanceIdResponse {
  Util.validateModel(request);
  var query = {};
  if (!Util.isUnset(request.buId)) {
    query['BuId'] = request.buId;
  }
  if (!Util.isUnset(request.buName)) {
    query['BuName'] = request.buName;
  }
  if (!Util.isUnset(request.instanceId)) {
    query['InstanceId'] = request.instanceId;
  }
  if (!Util.isUnset(request.instanceName)) {
    query['InstanceName'] = request.instanceName;
  }
  if (!Util.isUnset(request.pid)) {
    query['Pid'] = request.pid;
  }
  if (!Util.isUnset(request.productSource)) {
    query['ProductSource'] = request.productSource;
  }
  if (!Util.isUnset(request.saleEnv)) {
    query['SaleEnv'] = request.saleEnv;
  }
  if (!Util.isUnset(request.saleRegion)) {
    query['SaleRegion'] = request.saleRegion;
  }
  var req = new OpenApi.OpenApiRequest{ 
    query = OpenApiUtil.query(query),
  };
  var params = new OpenApi.Params{
    action = 'XspaceNextbotCreateAndGetInstanceId',
    version = '2020-07-30',
    protocol = 'HTTPS',
    pathname = '/',
    method = 'POST',
    authType = 'AK',
    style = 'RPC',
    reqBodyType = 'formData',
    bodyType = 'json',
  };
  return callApi(params, req, runtime);
}

async function xspaceNextbotCreateAndGetInstanceId(request: XspaceNextbotCreateAndGetInstanceIdRequest): XspaceNextbotCreateAndGetInstanceIdResponse {
  var runtime = new Util.RuntimeOptions{};
  return xspaceNextbotCreateAndGetInstanceIdWithOptions(request, runtime);
}

model XspaceNextbotCreateTenantRequest {
  buId?: string(name='BuId'),
  buName?: string(name='BuName'),
  instanceId?: string(name='InstanceId'),
}

model XspaceNextbotCreateTenantResponseBody = {
  code?: string(name='Code'),
  data?: long(name='Data'),
  httpStatusCode?: long(name='HttpStatusCode'),
  message?: string(name='Message'),
  requestId?: string(name='RequestId'),
  success?: boolean(name='Success'),
}

model XspaceNextbotCreateTenantResponse = {
  headers: map[string]string(name='headers'),
  statusCode: int32(name='statusCode'),
  body: XspaceNextbotCreateTenantResponseBody(name='body'),
}

async function xspaceNextbotCreateTenantWithOptions(request: XspaceNextbotCreateTenantRequest, runtime: Util.RuntimeOptions): XspaceNextbotCreateTenantResponse {
  Util.validateModel(request);
  var query = {};
  if (!Util.isUnset(request.buId)) {
    query['BuId'] = request.buId;
  }
  if (!Util.isUnset(request.buName)) {
    query['BuName'] = request.buName;
  }
  if (!Util.isUnset(request.instanceId)) {
    query['InstanceId'] = request.instanceId;
  }
  var req = new OpenApi.OpenApiRequest{ 
    query = OpenApiUtil.query(query),
  };
  var params = new OpenApi.Params{
    action = 'XspaceNextbotCreateTenant',
    version = '2020-07-30',
    protocol = 'HTTPS',
    pathname = '/',
    method = 'POST',
    authType = 'AK',
    style = 'RPC',
    reqBodyType = 'formData',
    bodyType = 'json',
  };
  return callApi(params, req, runtime);
}

async function xspaceNextbotCreateTenant(request: XspaceNextbotCreateTenantRequest): XspaceNextbotCreateTenantResponse {
  var runtime = new Util.RuntimeOptions{};
  return xspaceNextbotCreateTenantWithOptions(request, runtime);
}

model XspaceNextbotGetInstanceIdByBuIdRequest {
  tenantId?: long(name='TenantId'),
}

model XspaceNextbotGetInstanceIdByBuIdResponseBody = {
  code?: string(name='Code'),
  data?: {
    instanceId?: string(name='InstanceId'),
    instanceName?: string(name='InstanceName'),
    tenantId?: long(name='TenantId'),
  }(name='Data'),
  httpStatusCode?: long(name='HttpStatusCode'),
  message?: string(name='Message'),
  requestId?: string(name='RequestId'),
  success?: boolean(name='Success'),
}

model XspaceNextbotGetInstanceIdByBuIdResponse = {
  headers: map[string]string(name='headers'),
  statusCode: int32(name='statusCode'),
  body: XspaceNextbotGetInstanceIdByBuIdResponseBody(name='body'),
}

async function xspaceNextbotGetInstanceIdByBuIdWithOptions(request: XspaceNextbotGetInstanceIdByBuIdRequest, runtime: Util.RuntimeOptions): XspaceNextbotGetInstanceIdByBuIdResponse {
  Util.validateModel(request);
  var query = {};
  if (!Util.isUnset(request.tenantId)) {
    query['TenantId'] = request.tenantId;
  }
  var req = new OpenApi.OpenApiRequest{ 
    query = OpenApiUtil.query(query),
  };
  var params = new OpenApi.Params{
    action = 'XspaceNextbotGetInstanceIdByBuId',
    version = '2020-07-30',
    protocol = 'HTTPS',
    pathname = '/',
    method = 'POST',
    authType = 'AK',
    style = 'RPC',
    reqBodyType = 'formData',
    bodyType = 'json',
  };
  return callApi(params, req, runtime);
}

async function xspaceNextbotGetInstanceIdByBuId(request: XspaceNextbotGetInstanceIdByBuIdRequest): XspaceNextbotGetInstanceIdByBuIdResponse {
  var runtime = new Util.RuntimeOptions{};
  return xspaceNextbotGetInstanceIdByBuIdWithOptions(request, runtime);
}

model XspaceNextbotInitTenantRequest {
  account?: string(name='Account'),
  accountType?: string(name='AccountType'),
  instanceId?: string(name='InstanceId'),
  kwLibrary?: string(name='KwLibrary'),
  productValidPeriod?: long(name='ProductValidPeriod'),
  productVersion?: string(name='ProductVersion'),
  tenantDesc?: string(name='TenantDesc'),
  tenantId?: long(name='TenantId'),
  tenantName?: string(name='TenantName'),
}

model XspaceNextbotInitTenantResponseBody = {
  code?: string(name='Code'),
  data?: string(name='Data'),
  httpStatusCode?: long(name='HttpStatusCode'),
  message?: string(name='Message'),
  requestId?: string(name='RequestId'),
  success?: boolean(name='Success'),
}

model XspaceNextbotInitTenantResponse = {
  headers: map[string]string(name='headers'),
  statusCode: int32(name='statusCode'),
  body: XspaceNextbotInitTenantResponseBody(name='body'),
}

async function xspaceNextbotInitTenantWithOptions(request: XspaceNextbotInitTenantRequest, runtime: Util.RuntimeOptions): XspaceNextbotInitTenantResponse {
  Util.validateModel(request);
  var query = {};
  if (!Util.isUnset(request.account)) {
    query['Account'] = request.account;
  }
  if (!Util.isUnset(request.accountType)) {
    query['AccountType'] = request.accountType;
  }
  if (!Util.isUnset(request.instanceId)) {
    query['InstanceId'] = request.instanceId;
  }
  if (!Util.isUnset(request.kwLibrary)) {
    query['KwLibrary'] = request.kwLibrary;
  }
  if (!Util.isUnset(request.productValidPeriod)) {
    query['ProductValidPeriod'] = request.productValidPeriod;
  }
  if (!Util.isUnset(request.productVersion)) {
    query['ProductVersion'] = request.productVersion;
  }
  if (!Util.isUnset(request.tenantDesc)) {
    query['TenantDesc'] = request.tenantDesc;
  }
  if (!Util.isUnset(request.tenantId)) {
    query['TenantId'] = request.tenantId;
  }
  if (!Util.isUnset(request.tenantName)) {
    query['TenantName'] = request.tenantName;
  }
  var req = new OpenApi.OpenApiRequest{ 
    query = OpenApiUtil.query(query),
  };
  var params = new OpenApi.Params{
    action = 'XspaceNextbotInitTenant',
    version = '2020-07-30',
    protocol = 'HTTPS',
    pathname = '/',
    method = 'POST',
    authType = 'AK',
    style = 'RPC',
    reqBodyType = 'formData',
    bodyType = 'json',
  };
  return callApi(params, req, runtime);
}

async function xspaceNextbotInitTenant(request: XspaceNextbotInitTenantRequest): XspaceNextbotInitTenantResponse {
  var runtime = new Util.RuntimeOptions{};
  return xspaceNextbotInitTenantWithOptions(request, runtime);
}

model CreateTicketWithBizDataRequest {
  bizData?: string(name='BizData'),
  carbonCopy?: string(name='CarbonCopy'),
  categoryId?: long(name='CategoryId'),
  clientToken?: string(name='ClientToken'),
  creatorId?: long(name='CreatorId'),
  creatorName?: string(name='CreatorName'),
  creatorType?: int32(name='CreatorType'),
  formData?: string(name='FormData'),
  fromInfo?: string(name='FromInfo'),
  instanceId?: string(name='InstanceId'),
  memberId?: long(name='MemberId'),
  memberName?: string(name='MemberName'),
  priority?: int32(name='Priority'),
  templateId?: long(name='TemplateId'),
}

model CreateTicketWithBizDataResponseBody = {
  code?: string(name='Code'),
  data?: long(name='Data'),
  message?: string(name='Message'),
  requestId?: string(name='RequestId'),
  success?: boolean(name='Success'),
}

model CreateTicketWithBizDataResponse = {
  headers: map[string]string(name='headers'),
  statusCode: int32(name='statusCode'),
  body: CreateTicketWithBizDataResponseBody(name='body'),
}

async function createTicketWithBizDataWithOptions(request: CreateTicketWithBizDataRequest, runtime: Util.RuntimeOptions): CreateTicketWithBizDataResponse {
  Util.validateModel(request);
  var body : map[string]any = {};
  if (!Util.isUnset(request.bizData)) {
    body['BizData'] = request.bizData;
  }
  if (!Util.isUnset(request.carbonCopy)) {
    body['CarbonCopy'] = request.carbonCopy;
  }
  if (!Util.isUnset(request.categoryId)) {
    body['CategoryId'] = request.categoryId;
  }
  if (!Util.isUnset(request.clientToken)) {
    body['ClientToken'] = request.clientToken;
  }
  if (!Util.isUnset(request.creatorId)) {
    body['CreatorId'] = request.creatorId;
  }
  if (!Util.isUnset(request.creatorName)) {
    body['CreatorName'] = request.creatorName;
  }
  if (!Util.isUnset(request.creatorType)) {
    body['CreatorType'] = request.creatorType;
  }
  if (!Util.isUnset(request.formData)) {
    body['FormData'] = request.formData;
  }
  if (!Util.isUnset(request.fromInfo)) {
    body['FromInfo'] = request.fromInfo;
  }
  if (!Util.isUnset(request.instanceId)) {
    body['InstanceId'] = request.instanceId;
  }
  if (!Util.isUnset(request.memberId)) {
    body['MemberId'] = request.memberId;
  }
  if (!Util.isUnset(request.memberName)) {
    body['MemberName'] = request.memberName;
  }
  if (!Util.isUnset(request.priority)) {
    body['Priority'] = request.priority;
  }
  if (!Util.isUnset(request.templateId)) {
    body['TemplateId'] = request.templateId;
  }
  var req = new OpenApi.OpenApiRequest{ 
    body = OpenApiUtil.parseToMap(body),
  };
  var params = new OpenApi.Params{
    action = 'createTicketWithBizData',
    version = '2020-07-30',
    protocol = 'HTTPS',
    pathname = '/',
    method = 'POST',
    authType = 'AK',
    style = 'RPC',
    reqBodyType = 'formData',
    bodyType = 'json',
  };
  return callApi(params, req, runtime);
}

async function createTicketWithBizData(request: CreateTicketWithBizDataRequest): CreateTicketWithBizDataResponse {
  var runtime = new Util.RuntimeOptions{};
  return createTicketWithBizDataWithOptions(request, runtime);
}

